Use a recursive method to do the conversion.