@Override
  public void updateLaboratory(LaboratoryDto laboratoryDto) throws ServiceEntityNotFoundException {
    try {
      Laboratory laboratory = laboratoryDao.getLaboratoryById(laboratoryDto.getId());
      boolean studentsNeedUpdate = studentsNeedUpdate(laboratory, laboratoryDto);
      updateLaboratoryFields(laboratory, laboratoryDto);

      laboratoryDao.updateLaboratory(laboratory);

      if (studentsNeedUpdate) {
        laboratory.getStudents().clear();

        List<Student> students =
            studentDao.getStudents(
                laboratory.getSection(),
                laboratory.getYear(),
                laboratory.getSemester(),
                laboratory.getGroup(),
                laboratory.getSubgroup());
        laboratory.setStudents(students);
      }

    } catch (DaoEntityNotFoundException e) {
      LOGGER.debug("DaoEntityNotFoundException");
      throw new ServiceEntityNotFoundException(e);
    }
  }