addition of a variant to the upsert function so that the whole response is returned