public void delete(Course course) {

    courseVerifier.verifyCourseOnDelete(course);

    commonDao.deleteAllMeetingHoursForCourse(course.getId());
    courseDao.delete(course.getId());
  }
  public Course create(Course course, Instructor instructor) {
    courseVerifier.verifyCourseOnCreate(course, instructor);

    Long locationId = commonDao.provideCourseLocation(course.getLocation());
    Course newlyCreatedCourse = courseDao.create(course, instructor.getId(), locationId);

    createMeetingHours(course);

    return courseDao.getById(newlyCreatedCourse.getId());
  }
 private void createMeetingHours(Course course) {
   for (EventInformation eventInformation : course.getMeetingHours()) {
     Long eventInformationId = commonDao.getEventInformationId(eventInformation);
     if (eventInformationId == null) {
       commonDao.createEventInformation(eventInformation);
       eventInformationId = commonDao.getEventInformationId(eventInformation);
     }
     commonDao.createMeetingHours(course.getId(), eventInformationId);
   }
 }
  public Course update(Course course) {
    courseVerifier.verifyCourseOnUpdate(course);

    commonDao.deleteAllMeetingHoursForCourse(course.getId());
    Long locationId = commonDao.provideCourseLocation(course.getLocation());

    courseDao.update(course, locationId);

    createMeetingHours(course);

    return courseDao.getById(course.getId());
  }
  public List<Student> getStudentsByCourse(Course course) {

    courseVerifier.verifyCourseExists(course);
    List<Student> students = studentDao.getStudentsByCourse(course.getId());
    if (students.size() == 0) {
      logger.info("No students enrolled in this course were found");
    }
    return students;
  }
 public Instructor getInstructorByCourse(Course course) {
   courseVerifier.verifyCourseExists(course);
   Instructor instructor = instructorDao.getInstructorByCourse(course.getId());
   if (instructor == null) {
     logger.error("The course doesn't have an instructor. This shouldn't have happened");
     throw new GeneralException(
         "The course doesn't have an instructor. This shouldn't have happened");
   }
   return instructor;
 }
 public void updateInstructor(Course course, Instructor instructor) {
   courseVerifier.verifyUpdateInstructor(course, instructor);
   courseDao.updateInstructor(course.getId(), instructor.getId());
 }
 public void unEnrollStudent(Course course, Student student) {
   courseVerifier.verifyUnenrollStudent(course, student);
   courseDao.unenrollStudent(course.getId(), student.getId());
 }