private Boolean validateInput() {
    Boolean validation = true;

    // Check if inputs are null or empty
    if (_durationTextField.getText().length() == 0) {
      _durationTextField.setStyle("-fx-text-box-border: red;");
      validation = false;
    } else {
      _durationTextField.setStyle("-fx-text-box-border: lightgrey;");
    }

    if (_datePicker.getValue() == null) {
      _datePicker.setStyle("-fx-date-picker-border: red;");
      validation = false;
    } else {
      _datePicker.setStyle("-fx-date-picker-border: lightgrey;");
    }

    if (_startTimeTextField.getText().length() == 0) {
      _startTimeTextField.setStyle("-fx-text-box-border: red;");
      validation = false;
    } else {
      _startTimeTextField.setStyle("-fx-text-box-border: lightgrey;");
    }

    // check if inputs are matching the given regex
    if (validation) {
      if (_durationTextField.getText().matches("(\\d*)")) {
        _duration = Integer.parseInt(_durationTextField.getText());
        _durationTextField.setStyle("-fx-text-box-border:  lightgrey;");
      } else {
        _durationTextField.setStyle("-fx-text-box-border: red;");
        validation = false;
      }

      // define Regex: 0-24h, 0-59min, 0-69sek
      if (_startTimeTextField.getText().matches("([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])")) {
        _localDate = _datePicker.getValue();
        String[] times = _startTimeTextField.getText().split(":");
        _localTime =
            LocalTime.of(
                Integer.parseInt(times[0]), Integer.parseInt(times[1]), Integer.parseInt(times[2]));
        _startTimeTextField.setStyle("-fx-text-box-border: lightgrey;");
      } else {
        _startTimeTextField.setStyle("-fx-text-box-border: red;");
        validation = false;
      }
    }

    if (_allTeamsTableView.getSelectionModel().getSelectedItem() == null
        || _allTeamsOpponentTableView.getSelectionModel().getSelectedItem() == null) {
      validation = false;
    }

    return validation;
  }
 private void initSuccessAlert() {
   Alert alert = new Alert(Alert.AlertType.INFORMATION);
   alert.setHeaderText("Saving successful!");
   alert.setTitle("Saving successful");
   alert.setContentText(
       "A new Match between "
           + _allTeamsTableView.getSelectionModel().getSelectedItem().getName()
           + " and "
           + _allTeamsOpponentTableView.getSelectionModel().getSelectedItem().getName()
           + " was saved successfully!");
   alert.showAndWait();
 }
  public void setTournament(
      TournamentDTO tournament,
      HashSet<ExternalDisplayTeamDTO> externalDisplayTeamDTOs,
      Boolean newTournament)
      throws RemoteException {
    _tournament = tournament;
    _newTournament = newTournament;
    _externalDisplayTeamDTOs = externalDisplayTeamDTOs;

    List<DisplayTeamDTO> teams =
        SessionController.getInstance().getSession().getTeamRemote().getAllDisplayTeams();
    for (DisplayTeamDTO team : teams) {
      if (_tournament.getTeamIDs().contains(team.getId())) {
        _allTeamsTableView.getItems().add(team);
        _allTeamsOpponentTableView.getItems().add(team);
      }
    }
    _allTeamsTableView.getItems().addAll(_externalDisplayTeamDTOs);
    _allTeamsOpponentTableView.getItems().addAll(_externalDisplayTeamDTOs);
  }
  @FXML
  private void saveNewMatch() throws RemoteException {

    if (validateInput()) {

      MatchDTO newMatch = new MatchDTOImpl();
      newMatch.setDuration(_duration);
      Calendar cal = new GregorianCalendar();
      cal.set(
          _localDate.getYear(),
          _localDate.getMonthValue(),
          _localDate.getDayOfMonth(),
          _localTime.getHour(),
          _localTime.getMinute(),
          _localTime.getSecond());
      newMatch.setStart(cal.getTime());

      MatchDTOImpl.SimpleMatchTeamDTO team1 =
          new MatchDTOImpl.SimpleMatchTeamDTO(
              _allTeamsTableView.getSelectionModel().getSelectedItem().getId());
      team1.setId(_allTeamsOpponentTableView.getSelectionModel().getSelectedItem().getId());
      team1.setName(_allTeamsTableView.getSelectionModel().getSelectedItem().getName());
      team1.setVersion(_allTeamsTableView.getSelectionModel().getSelectedItem().getVersion());

      MatchDTOImpl.SimpleMatchTeamDTO team2 =
          new MatchDTOImpl.SimpleMatchTeamDTO(
              _allTeamsOpponentTableView.getSelectionModel().getSelectedItem().getId());
      team2.setId(_allTeamsOpponentTableView.getSelectionModel().getSelectedItem().getId());
      team2.setName(_allTeamsOpponentTableView.getSelectionModel().getSelectedItem().getName());
      team2.setVersion(
          _allTeamsOpponentTableView.getSelectionModel().getSelectedItem().getVersion());

      newMatch.setTeam1(team1);
      newMatch.setTeam2(team2);
      newMatch.setTournamentId(_tournament.getId());
      newMatch.setMatchStatus("Planned");

      _tournament.addMatch(newMatch);

      initSuccessAlert();
      // todo fix correct weiterleitung
      if (_newTournament) {
        SportifyGUI.getSharedMainApp().loadNewTournamentView(_tournament, _externalDisplayTeamDTOs);
      } else {
        SportifyGUI.getSharedMainApp().loadEditTournamentForm(_tournament);
      }
    }
  }