title: Error when deleting user information in Firebase
body: <p>I am attempting to integrate delete account functionality, but am running into an error. I believe I have found out the solution to the problem but am looking for input on an alternative solution as mine is unsafe.</p>
  
  <p>here is my delete account function</p>
  
  <pre><code>func deleteAccount()
  {
      let user = FIRAuth.auth()?.currentUser
      let uid = user!.uid
  
      self.dismissViewControllerAnimated(true, completion: nil)
      user?.deleteWithCompletion({ (error) in
          if error != nil
          {
              //error occurred during deletion
              print(error)
          }
          else
          {
              print("Account deleted")
  
              //account deleted, remove the user data and segue back
              let removedRef = FIRDatabase.database().referenceFromURL("https://myURL.com/users/\(uid)")
  
              //set nil to that value to delete it
              removedRef.setValue(nil)
          }
      })
  }
  </code></pre>
  
  <p>The error I am getting is removeValue failed: permission_denied. I'm assuming this is due to the fact that I delete my user prior to deleting the associated user information. However, if I were to move the deletion code outside of the closure block, if an error occurs then all of the user's information gets deleted regardless.</p>
  
  <p>I'm looking to improve on this deletion method.</p>