public void updateTimeSpentOnTask(JTable table, JComboBox userName, JComboBox comboboxStatus, JTextField textfieldTimeSpent, JTextArea textAreaComment) throws SQLException, IOException {
        DefaultTableModel tablemodel = (DefaultTableModel) table.getModel();
        User user = null;
        TimeSpentOnTask tsot = null;

        if (textfieldTimeSpent.getText().isEmpty() || textAreaComment.getText().isEmpty() || table.getSelectedRowCount() == 0) {
            JOptionPane.showMessageDialog(null, "Der skal angives hvilken opgave der skal indrapportes samt tid brugt og en kommentar", "Fejlrapport", JOptionPane.WARNING_MESSAGE);
        } else {
            int taskID = Integer.parseInt(tablemodel.getValueAt(table.convertRowIndexToModel(table.getSelectedRow()), 0).toString());
            Task task = getSelectedTask(taskID);

            user = getUserByUserName(userName);
            task.setStatusByID(comboboxStatus.getSelectedIndex() + 1);

            for (int i = 0; i < tsotList.size(); i++) {
                if (tsotList.get(i).getTaskID() == taskID && user.getUserName().equals(userName.getSelectedItem().toString()) && checkIfAllChildrenIsFinished(taskID)) {
                    tsot = tsotList.get(i);
                    int totalTimeSpent = tsot.getTimeSpent();
                    System.out.println("Før tid sammenlægning: " + totalTimeSpent);
                    totalTimeSpent = totalTimeSpent + Integer.parseInt(textfieldTimeSpent.getText());
                    System.out.println("EFTER : " + totalTimeSpent);
                    tsot.setTimeSpent(totalTimeSpent);
                    tsot.setComment(textAreaComment.getText());
                }
            }
            if (tsot == null) {
                tsot = new TimeSpentOnTask(taskID, user.getUserID(), Integer.parseInt(textfieldTimeSpent.getText()), textAreaComment.getText());
            }
            dbHandler.updateTimeSpentOnTask(tsot, task);
        }
    }