public void btnAddAssistantOrProfessor_Pressed() {
    if (!chBxAssistantsOrProfessors.getSelectionModel().isEmpty()) {
      ObservableList<String> updatedElements = listAssistantsOrProfessors.getItems();

      String valueSelected = chBxAssistantsOrProfessors.getSelectionModel().getSelectedItem();
      String rut = valueSelected.split("-")[valueSelected.split("-").length - 1];

      for (Professor professor : Manager.INSTANCE.professors) {
        if (rut.equals(professor.getRut())) {
          if (!((Lecture) Manager.INSTANCE.currentEditignICourse)
              .getProfessors()
              .contains(professor)) {
            ((Lecture) Manager.INSTANCE.currentEditignICourse).addProfessor(professor);
            updatedElements.add(valueSelected);
            listAssistantsOrProfessors.setItems(FXCollections.observableArrayList(updatedElements));
            break;
          } else {
            ViewUtilities.showAlert("El profesor ya se encuentra en ese curso");
            break;
          }
        }
      }
    } else {
      ViewUtilities.showAlert("Select a professor to add");
    }
  }
  public void btnRemoveAssistantOrProfessor_Pressed() {
    if (!listAssistantsOrProfessors.getSelectionModel().isEmpty()) {
      ObservableList<String> updatedElements = listAssistantsOrProfessors.getItems();

      String valueSelected = listAssistantsOrProfessors.getSelectionModel().getSelectedItem();
      String rut = valueSelected.split("-")[1];

      for (Professor professor : Manager.INSTANCE.professors) {
        if (rut.equals(professor.getRut())) {
          if (((Lecture) Manager.INSTANCE.currentEditignICourse)
              .getProfessors()
              .contains(professor)) {
            ((Lecture) Manager.INSTANCE.currentEditignICourse).removeProfessor(professor);
            updatedElements.remove(valueSelected);
            listAssistantsOrProfessors.setItems(updatedElements);
            break;
          } else {
            ViewUtilities.showAlert("El profesor no se encuentra registrado en la clase");
            break;
          }
        }
      }
    } else {
      ViewUtilities.showAlert("Primero debes seleccionar un profesor para quitar");
    }
  }
  public void btnSaveCourse_Pressed() {
    Schedule schedule = Manager.INSTANCE.currentEditingSchedule;
    Classroom classroom = null;

    if (!chBxClassrooms.getSelectionModel().isEmpty()) {
      String classroomString = chBxClassrooms.getSelectionModel().getSelectedItem();
      for (Classroom classroomLocal : Manager.INSTANCE.classrooms) {
        if (classroomLocal.getInitials().equals(classroomString)) {
          classroom = classroomLocal;
          break;
        }
      }

      String alertMessage = "";

      String clashes = "";
      ICourse iCourse = Manager.INSTANCE.currentEditignICourse;
      for (Professor professor : ((Lecture) iCourse).getProfessors()) {
        String pClash = CourseModificationChecker.professorClash(professor, schedule, iCourse);
        if (!pClash.equals("")) {
          clashes +=
              professor.getName() + " " + professor.getLastnameFather() + ":" + pClash + "\n";
        }
      }

      if (!clashes.equals("")) {
        alertMessage +=
            "No se puede usar este horario, ya que tiene problemas de topes de horarios de profesores:\n"
                + clashes;
      }

      clashes =
          CourseModificationChecker.classroomClash(
              classroom, schedule, Manager.INSTANCE.currentEditignICourse);

      if (clashes != "") {
        alertMessage +=
            "No se puede crear la clase debido a que la sala esta ocupada en ese horario por otro(s) curso(s):\n"
                + clashes;
      }

      if (!alertMessage.equals("")) {
        ViewUtilities.showAlert(alertMessage);
      } else {
        Manager.INSTANCE.currentEditignICourse.setSchedule(schedule);
        Manager.INSTANCE.currentEditignICourse.setClassroom(classroom);

        if (isCreating) {
          Manager.INSTANCE.currentEditignCourse.addCourse(Manager.INSTANCE.currentEditignICourse);
        }

        Manager.INSTANCE.currentEditignICourse = null;
        Manager.INSTANCE.currentEditingSchedule = null;
        super.btnBack_Pressed();
      }
    } else {
      ViewUtilities.showAlert("Primero debes asignar una sala a la clase");
    }
  }
 public void btnRemoveICourse_Pressed() {
   if (Manager.INSTANCE.currentEditignICourse != null) {
     ArrayList<ICourse> courses = Manager.INSTANCE.currentEditignCourse.getCourses();
     if (courses.contains(Manager.INSTANCE.currentEditignICourse)) {
       courses.remove(Manager.INSTANCE.currentEditignICourse);
       Manager.INSTANCE.currentEditignCourse.setCourses(courses);
       super.btnBack_Pressed();
     } else {
       ViewUtilities.showAlert("The class is not in the classes of the course");
     }
   } else {
     ViewUtilities.showAlert("The ICourse is null");
   }
 }