Creating recursive method to format transactions