Pull out conversion logic + deduplicate the orderitems before rendering the template