Added upsert to repository