Adding primary key support for upsert