Change insert to update with upsert