Refactor upsert to use POST params