context) { this.context = context.getApplicationContext(); } ! public Observable<User> addUser(String userName) { return RealmObservable.object(context, new Func1<Realm, RealmUser>() { @Override public RealmUser call(Realm realm) { RealmUser realmUser = new RealmUser(); realmUser.setName(userName); return realm.copyToRealm(realmUser); } }).map(new Func1<RealmUser, User>() { @Override public User call(RealmUser realmUser) { // map to UI object return new User(realmUser.getName()); } }); } } Data Service