rewrite the upsert logic