private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed
        String name = txtFieldName.getText();
        String password = txtPassword.getText();
        int staffId = -1;
        PersonalType st = (PersonalType) cmbBoxPersonalTypes.getSelectedItem();
        String username = txtUsername.getText();

        String errorMessage = "";
        name.trim();
        password.trim();
        if (name.isEmpty()) {
            errorMessage += "*  Please enter a name first <br>";
        }
        if(username.isEmpty()){
            errorMessage += "*  Please enter a username <br>";
        }
        if((staff == null) && (password.isEmpty())){
            errorMessage += "*  Please enter a password <br>";
        }
        
        

        if (errorMessage.isEmpty()) {
            if (staff == null) {
                staff = new Staff();
                staff.setName(name);
                staff.setUsername(username);
                staff.setPrimaryAirport(airport);
                staff.setType(st);
                staff.setPassword(password, true);
                staff.setRank(Rank.STAFF);
                

                if (Controller.Instance().save(staff)) {
                    JOptionPane.showMessageDialog(this, "Staff " + staff.getName() + " Saved");
                    this.dispose();
                }
            } else {
                staff.setName(name);
                staff.setUsername(username);
                
                if(txtFieldAirport.getText().isEmpty()){
                staff.setPrimaryAirport(null);
                }else{
                staff.setPrimaryAirport(airport);                        
                }
                staff.setType(st);
                staff.setPassword(password, true);
                staff.setRank(Rank.STAFF);

                if (Controller.Instance().update(staff)) {
                    JOptionPane.showMessageDialog(this, "Staff " + staff.getName() + " Saved");
                    this.dispose();
                }
            }
            this.dispose();
        }
        lblErrorMessage.setText("<html> " + errorMessage + " </html>");
    }//GEN-LAST:event_btnSaveActionPerformed