public static SatsClass copy( Realm realm, SatsClass newObject, boolean update, Map<RealmObject, RealmObject> cache) { SatsClass realmObject = realm.createObject(SatsClass.class, newObject.getId()); cache.put(newObject, realmObject); realmObject.setId(newObject.getId() != null ? newObject.getId() : ""); realmObject.setCenterFilterId( newObject.getCenterFilterId() != null ? newObject.getCenterFilterId() : ""); realmObject.setClassTypeId( newObject.getClassTypeId() != null ? newObject.getClassTypeId() : ""); realmObject.setDurationInMinutes(newObject.getDurationInMinutes()); realmObject.setInstructorId( newObject.getInstructorId() != null ? newObject.getInstructorId() : ""); realmObject.setName(newObject.getName() != null ? newObject.getName() : ""); realmObject.setStartTime(newObject.getStartTime() != null ? newObject.getStartTime() : ""); realmObject.setBookedPersonsCount(newObject.getBookedPersonsCount()); realmObject.setMaxPersonsCount(newObject.getMaxPersonsCount()); realmObject.setRegionId(newObject.getRegionId() != null ? newObject.getRegionId() : ""); realmObject.setWaitingListCount(newObject.getWaitingListCount()); RealmList<ClassCategoryIds> classCategoryIdsList = newObject.getClassCategoryIds(); if (classCategoryIdsList != null) { RealmList<ClassCategoryIds> classCategoryIdsRealmList = realmObject.getClassCategoryIds(); for (int i = 0; i < classCategoryIdsList.size(); i++) { ClassCategoryIds classCategoryIdsItem = classCategoryIdsList.get(i); ClassCategoryIds cacheclassCategoryIds = (ClassCategoryIds) cache.get(classCategoryIdsItem); if (cacheclassCategoryIds != null) { classCategoryIdsRealmList.add(cacheclassCategoryIds); } else { classCategoryIdsRealmList.add( ClassCategoryIdsRealmProxy.copyOrUpdate( realm, classCategoryIdsList.get(i), update, cache)); } } } return realmObject; }