title: Detach RealmObject from Realm / Convert managed RealmObject to unmanaged Object
body: <p>I want to "detach" a <code>RealmObject</code> from its <code>Realm</code>, meaning that I want to be able to return a <code>RealmObject</code> from a method and be able to use it after I <code>close</code> the <code>Realm</code> instance.</p>
  
  <p>Something like this:</p>
  
  <pre><code>public Person getPersonWithId(final Context context, final String personId){
      Realm realm = Realm.getInstance(context);
      Person person = realm.where.....;
      realm.close();
      return person;
  }
  </code></pre>
  
  <p>Currently <code>getPersonWithId(mContext, personId).getName()</code> will return an error, as expected. </p>
  
  <p>Having a managed object will also mean the object is immutable (cannot be modified) and so any method updating the object like <code>person.setName(String name)</code> will fail due to the object being a managed object.</p>
  
  <p>I wish there would be a method like <code>Person person = person.detachFromRealm();</code></p>
  
  <p>Does anyone know a solution/workaround for this problem?</p>