Update update_purchase

Make it more resilient so if there is bad data there it will update
purchase_items properly