@Override
    protected Entity getEntity(int row, int id) {
        final String name = nameTextField.getText();
        if (StringUtils.isNullOrEmpty(name)) {
            GUIUtils.showErrorMessage(new EmptyFieldException("Название"));
            return null;
        }
        
        short year = (short) yearSpinner.getValue();
        short strength = (short) strengthSpinner.getValue();
        if (strength > 125) {
            GUIUtils.showErrorMessage(new ValueOutOfRangeException(strength, "> 125"));
            return null;
        }
        
        int specialityIndex = specialityComboBox.getSelectedIndex();
        if ( (specialityIndex < 0) || (specialityIndex >= specialities.length) ) {
            GUIUtils.showErrorMessage(new EmptyFieldException("Специальность"));
            return null;
        }
        int departmentIndex = departmentComboBox.getSelectedIndex();
        if ( (departmentIndex < 0) || (departmentIndex >= departments.length) ) {
            GUIUtils.showErrorMessage(new EmptyFieldException("Кафедра"));
            return null;
        }
        int educationFormIndex = educationFormComboBox.getSelectedIndex();
        if ( (educationFormIndex < 0) || (educationFormIndex >= educationForms.length) ) {
            GUIUtils.showErrorMessage(new EmptyFieldException("Форма обучения"));
            return null;
        }
        
        Groups gr = new Groups();
        gr.setId(id);
        gr.setName(name);
        gr.setFormationYear(year);
        gr.setStrength(strength);
        gr.setSpecialityId(specialities[specialityIndex].getId());
        gr.setDepartmentId(departments[departmentIndex].getId());
        gr.setEducationFormId(educationForms[educationFormIndex].get_Id());
        
        return gr;
    }