public void SaveChangesToTask(JTable tableAllTasks, JList listUsers, JList listUsersOnTask, JTextField textFieldTaskName,
            JComboBox comboBoxType, JComboBox comboBoxStatus, JTextField textFieldCustomer, JComboBox comboBoxTaskLeader, JDateChooser dateChooserExpectedStart,
            JDateChooser dateChooserExpectedEnd, JTextField textFieldEstimatedTime, JComboBox comboBoxPriority, JTextArea textAreaDescription) throws SQLException, IOException {
        DefaultTableModel modelTable = (DefaultTableModel) tableAllTasks.getModel();
        DefaultListModel modelOnTask = (DefaultListModel) listUsersOnTask.getModel();
        Type type = null;
        Statuss status = null;
        Customer customer = null;
        User user = null;

        if (textFieldTaskName.getText() == "" || textFieldCustomer.getText() == "" || textFieldEstimatedTime.getText() == "") {
            JOptionPane.showMessageDialog(null, "Der skal angives et opgave navn, kunde og en estimering af tid der skal bruges", "Fejlrapport", JOptionPane.WARNING_MESSAGE);
        } else {
            ArrayList<User> userOnTask = new ArrayList<>();

            user = getUserByUserName(comboBoxTaskLeader);

            for (int i = 0; i < Controller.statusList.size(); i++) {
                if (Controller.statusList.get(i).getStatussName().equals(comboBoxStatus.getSelectedItem().toString())) {
                    status = Controller.statusList.get(i);
                }
            }

            for (int i = 0; i < Controller.customerList.size(); i++) {
                if (Controller.customerList.get(i).getCustomerID() == Integer.parseInt(textFieldCustomer.getText())) {
                    customer = Controller.customerList.get(i);
                }
            }

            for (int i = 0; i < Controller.typeList.size(); i++) {
                if (Controller.typeList.get(i).getTypeName().equals(comboBoxType.getSelectedItem().toString())) {
                    type = Controller.typeList.get(i);
                }
            }

            for (int i = 0; i < modelOnTask.getSize(); i++) {
                userOnTask.add((User) modelOnTask.getElementAt(i));
            }

            //Create new task object
            Task task = new Task(Integer.parseInt(modelTable.getValueAt(tableAllTasks.convertRowIndexToModel(tableAllTasks.getSelectedRow()), 0).toString()),
                    Integer.parseInt(modelTable.getValueAt(tableAllTasks.getSelectedRow(), 1).toString()),
                    textFieldTaskName.getText(),
                    type,
                    status,
                    customer,
                    user,
                    dateChooserExpectedStart.getDate(),
                    dateChooserExpectedEnd.getDate(),
                    Integer.parseInt(textFieldEstimatedTime.getText()),
                    Integer.parseInt(comboBoxPriority.getSelectedItem().toString()),
                    textAreaDescription.getText(),
                    userOnTask);

            Controller.dbHandler.updateTask(task);
            // Controller.dbHandler.addUserToAlreadyMadeTask(listUsersOnTask, task.getTaskID());
            fillList(listUsers, Controller.userList);
            fillTableUsingTaskList(tableAllTasks);
        }
    }