title: iOS Parse - Delete & Update Record
body: <p>I am developing an iOS app with multiple procedures executing. One of the procedures is registering a user. In total this process currently requires approximately 7 requests to Parse backend to complete. I am trying to optimize the number of requests i.e. reduce them. </p>
  
  <p>I have this code that basically check if array value in Parse class is empty or not. If not empty then I empty it and make another request afterwards to add the new value. How can I make this in a single request? i.e. a request to erase current value of array column in Parse class and insert two elements into this array (latitude and longitude)?</p>
  
  <p>Some of the code responsible for the operation </p>
  
  <pre><code>/*To clear existing values in array*/
              let query = PFQuery(className:"_User")
  
              query.getObjectInBackgroundWithId(PFUser.currentUser()!.objectId!) {
                  (gameScore: PFObject?, error: NSError?) -&gt; Void in
                  if error != nil {
                      print(error)
                  } else if let gameScore = gameScore {
                      print("No Errors.........")
                      gameScore.removeObjectsInArray(self.tempWorkAddressValues, forKey: "workAddress")
                      print("Step 1 Completed")
                      gameScore.saveInBackground()
                      print("successfully cleared array")
                  }
              }
  
              /*to add new elemnets to array*/
              let query2 = PFQuery(className:"_User")
  
              query2.getObjectInBackgroundWithId(PFUser.currentUser()!.objectId!) {
                  (gameScore: PFObject?, error: NSError?) -&gt; Void in
                  if error != nil {
                      print(error)
                  } else if let gameScore = gameScore {
                      print("No Errors.........")
                      gameScore.addObjectsFromArray(self.userObject.workAddress, forKey: "workAddress")
                      print("Step 2 Completed")
                      gameScore.saveInBackground()
                      print("successfully updated array")
                      self.performSegueWithIdentifier("addressWorkBackToProfileSegue", sender: sender);
  
                  }
              }
  </code></pre>
  
  <p>Thanks for the help in advance.</p>