private void setNonIdProperties(StudyGroup studyGroup, StudyGroupClientData clientData) {
    studyGroup.setStudyGroupNumber(clientData.studyGroupName);

    if (!clientData.studyGroupAnimals.isEmpty()) {
      studyGroup.setAnimals(getStudyGroupAnimals(clientData));
    } else {
      clearStudyGroupAnimals(studyGroup);
    }
  }
 public StudyGroupClientData create(StudyGroup studyGroup) {
   StudyGroupClientData studyGroupClientData = new StudyGroupClientData();
   studyGroupClientData.studyGroupId = studyGroup.getId();
   studyGroupClientData.studyGroupName = studyGroup.getStudyGroupNumber();
   for (Animal animal : studyGroup.getAnimals()) {
     AnimalClientData animalClientData = new AnimalClientData();
     animalClientData.id = animal.getId();
     animalClientData.number = animal.getAnimalNumber();
     studyGroupClientData.studyGroupAnimals.add(animalClientData);
   }
   return studyGroupClientData;
 }
 private void clearStudyGroupAnimals(StudyGroup studyGroup) {
   if (studyGroup.getAnimals() != null) {
     Set<Animal> currentStudyGroupAnimals = studyGroup.getAnimals();
     currentStudyGroupAnimals.clear();
   }
 }