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; }