public IEnumerator upsertObjectInstance(ObjectInstance objectInstance) { // Assemble payload JSONObject jsonBody = new JSONObject(); jsonBody.Add("instance", objectInstance.toJson()); // Send request Coroutine <string> routine = owner.StartCoroutine <string>( sfClient.runApex("POST", "ObjectInstance", jsonBody.ToString(), null) ); yield return(routine.coroutine); // Parse JSON response JSONObject jsonResponse = JSONObject.Parse(routine.getValue()); yield return(new ObjectInstance(jsonResponse)); }