Implements upsert
Implements upsert and query all through remote db