private void populateLaboratoryFields(Laboratory laboratory) throws DaoEntityNotFoundException {
    Hour from = hourDao.getHourByValue(laboratory.getFrom().getValue());
    Hour to = hourDao.getHourByValue(laboratory.getTo().getValue());
    Professor professor = professorDao.getProfessorByPnc(laboratory.getProfessor().getPnc());
    Room room = roomDao.getRoomByName(laboratory.getRoom().getName());
    Day day = dayDao.getDayByValue(laboratory.getDay().getValue());
    Section section = sectionDao.getSectionByName(laboratory.getSection().getName());
    Group group = groupDao.getGroupByName(laboratory.getGroup().getName());
    Subgroup subgroup = subgroupDao.getSubgroupByName(laboratory.getSubgroup().getName());
    Year year = yearDao.getYearByValue(laboratory.getYear().getValue());
    Semester semester = semesterDao.getSemesterByValue(laboratory.getSemester().getValue());
    WeeklyOccurrence weeklyOccurrence =
        weeklyOccurrenceDao.getWeeklyOccurrenceByName(laboratory.getWeeklyOccurrence().getName());
    List<Student> students = studentDao.getStudents(section, year, semester, group, subgroup);

    laboratory.setFrom(from);
    laboratory.setTo(to);
    laboratory.setProfessor(professor);
    laboratory.setRoom(room);
    laboratory.setDay(day);
    laboratory.setSection(section);
    laboratory.setGroup(group);
    laboratory.setSubgroup(subgroup);
    laboratory.setYear(year);
    laboratory.setSemester(semester);
    laboratory.setWeeklyOccurrence(weeklyOccurrence);
    laboratory.setStudents(students);
  }
  private void updateLaboratoryFields(Laboratory laboratory, LaboratoryDto laboratoryDto)
      throws DaoEntityNotFoundException {

    String compressedFields = laboratoryDto.getFormProfessorDto().getCompressedFields();
    String pnc = compressedFields.replaceAll("\\)", " ").replaceAll("\\(", " ").split(" ")[0];

    Hour from = hourDao.getHourByValue(laboratoryDto.getFrom());
    Hour to = hourDao.getHourByValue(laboratoryDto.getTo());
    Professor professor = professorDao.getProfessorByPnc(pnc);
    Room room = roomDao.getRoomByName(laboratoryDto.getRoom());
    Day day = dayDao.getDayByValue(laboratoryDto.getDay());
    Section section = sectionDao.getSectionByName(laboratoryDto.getSection());
    Group group = groupDao.getGroupByName(laboratoryDto.getGroup());
    Subgroup subgroup = subgroupDao.getSubgroupByName(laboratoryDto.getSubgroup());
    Year year = yearDao.getYearByValue(laboratoryDto.getYear());
    Semester semester = semesterDao.getSemesterByValue(laboratoryDto.getSemester());
    WeeklyOccurrence weeklyOccurrence =
        weeklyOccurrenceDao.getWeeklyOccurrenceByName(laboratoryDto.getWeeklyOccurrence());

    laboratory.setFrom(from);
    laboratory.setTo(to);
    laboratory.setProfessor(professor);
    laboratory.setRoom(room);
    laboratory.setDay(day);
    laboratory.setSection(section);
    laboratory.setGroup(group);
    laboratory.setSubgroup(subgroup);
    laboratory.setYear(year);
    laboratory.setSemester(semester);
    laboratory.setWeeklyOccurrence(weeklyOccurrence);
  }