private void saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveActionPerformed
        try {
            if (!valid()) {
		return;
	    }

            System.out.println("\"" + comboGemeentes.getSelectedItem() + "\"");

            model.setFirm(txtFirma.getText());
            model.setSortKey(txtFirma.getText());
            model.setContact(txtContact.getText());
            model.setAddress(txtAdres.getText());
            model.setZipcode(txtPostcode.getText());
            model.setMunicipality(comboGemeentes.getSelectedItem().toString());
            model.setTelephone(txtTel.getText());
            model.setTelephone2(txttel2.getText());
            model.setCellphone(txtGSM.getText());
            model.setFax(txtFax.getText());
            model.setEmail(txtEmail.getText());
            model.setNotes(notesOutlet.getText());
            model.setTaxnumber(taxnrOutlet.getText());
            model.setPricecode(pricecodeOutlet.getSelectedItem().toString());
//            if (type == Contact.both) {
//                model.setType(typeBox.getSelectedIndex() == 0 ? "supplier" : "client");
//            } else if (type == Contact.supplier) {
                model.setType("supplier");
//            } else if (type == Contact.client) {
//                model.setType("client");
//            }

//            if (!defaultModel.getSortKey().equalsIgnoreCase(model.getSortKey())) {
//                if (Database.driver().getContactsAlphabetically().containsKey(model.getSortKey().toLowerCase())) {
//                    JOptionPane.showMessageDialog(null, "Er is al een contactpersoon met deze toonnaam.", "Fout!", JOptionPane.ERROR_MESSAGE);
//                    return;
//                }
//            }

            FunctionResult res = model.update();
            if (res.getCode() == 0) {
                delegate.editContact(defaultModel, model);
                disposeLater();
            } else {
                String msg;
                switch (res.getCode()) {
                    case 1:
                    case 2:
                    case 3:
                        msg = res.getMessage();
                        break;
                    default:
                        msg = "Er is een fout opgetreden bij het opslaan van deze contactpersoon in de databank (code " + res.getCode() + "). Contacteer de ontwikkelaars met deze informatie.";
                }
                JOptionPane.showMessageDialog(null, msg, "Fout!", JOptionPane.ERROR_MESSAGE);
            }
        } catch (Exception e) {
            System.err.println("Error:");
            e.printStackTrace();
            JOptionPane.showMessageDialog(null, Utilities.incorrectFormMessage, "Fout!", JOptionPane.ERROR_MESSAGE);
        }

    }//GEN-LAST:event_saveActionPerformed