Adds conditions to the upsert operation

Conditions need to be added to the newly created object. The code was only
creating objectId.

Resolves #54