title: Cannot modify managed objects outside of a write transaction ( Realm + Android )
body: <p>I have implement the following method to update <code>UserProfile</code> from realm db.</p>
  
  <pre><code>override fun updateCurrentUser(userProfile: UserProfile, successAction: () -&gt; Unit) {
          val realm = Realm.getDefaultInstance()
          realm.executeTransactionAsync(
                  object : Realm.Transaction {
                      override fun execute(realm: Realm) {
  
                          val user = realm.where(UserProfile::class.java).equalTo("userName", userProfile.userName).findFirst()
                          user?.firstName = userProfile.firstName
                          user?.lastName = userProfile.lastName
                          user?.gender = userProfile.gender
                          user?.height = userProfile.height
                          user?.weight = userProfile.weight
                          user?.dob = userProfile.dob
                          user?.firstTimeSetupDone = true
  
                      }
                  },
                  object : Realm.Transaction.OnSuccess {
                      override fun onSuccess() {
                          Log.i(TAG, "Saved User successfully with $userProfile")
                          successAction()
                      }
  
                  },
                  object : Realm.Transaction.OnError {
                      override fun onError(error: Throwable?) {
                          Log.e(TAG, "Error saving user", error)
                      }
                  }
          )
      }
  </code></pre>
  
  <p>But it throws the following error even though I'm executing it under <code>realm.executeTransactionAsync</code></p>
  
  <pre><code>java.lang.IllegalStateException: Cannot modify managed objects outside of a write transaction.
                                                                              at io.realm.internal.Table.throwImmutable(Table.java:674)
                                                                              at io.realm.internal.Table.checkImmutable(Table.java:549)
                                                                              at io.realm.internal.UncheckedRow.setString(UncheckedRow.java:230)
                                                                              at io.realm.UserProfileRealmProxy.realmSet$firstName(UserProfileRealmProxy.java:209)
                                                                              at saukya.wellness.mobile.services.data.domain.UserProfile.setFirstName(UserProfile.kt:27)
                                                                              at saukya.wellness.mobile.ui.onboarding.OnBoardingPresenter.submitData(OnBoardingPresenter.kt:102)
                                                                              at saukya.wellness.mobile.ui.onboarding.OnBoardingActivity.submitData(OnBoardingActivity.kt:106)
                                                                              at saukya.wellness.mobile.ui.onboarding.OnBoardingHealthInfoFragment$setupNextButton$1.onClick(OnBoardingHealthInfoFragment.kt:86)
                                                                              at android.view.View.performClick(View.java:5646)
                                                                              at android.view.View$PerformClick.run(View.java:22459)
                                                                              at android.os.Handler.handleCallback(Handler.java:761)
                                                                              at android.os.Handler.dispatchMessage(Handler.java:98)
                                                                              at android.os.Looper.loop(Looper.java:156)
                                                                              at android.app.ActivityThread.main(ActivityThread.java:6523)
                                                                              at java.lang.reflect.Method.invoke(Native Method)
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
  </code></pre>