public static SatsClass copyOrUpdate(
      Realm realm, SatsClass object, boolean update, Map<RealmObject, RealmObject> cache) {
    if (object.realm != null && object.realm.getId() == realm.getId()) {
      return object;
    }
    SatsClass realmObject = null;
    boolean canUpdate = update;
    if (canUpdate) {
      Table table = realm.getTable(SatsClass.class);
      long pkColumnIndex = table.getPrimaryKey();
      long rowIndex = table.findFirstString(pkColumnIndex, object.getId());
      if (rowIndex != TableOrView.NO_MATCH) {
        realmObject = new SatsClassRealmProxy();
        realmObject.realm = realm;
        realmObject.row = table.getRow(rowIndex);
        cache.put(object, realmObject);
      } else {
        canUpdate = false;
      }
    }

    if (canUpdate) {
      return update(realm, realmObject, object, cache);
    } else {
      return copy(realm, object, update, cache);
    }
  }
  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;
  }