private void createOfficeHours(Instructor instructor) {
   for (EventInformation eventInformation : instructor.getOfficeHours()) {
     Long eventInformationId = commonDao.getEventInformationId(eventInformation);
     if (eventInformationId == null) {
       commonDao.createEventInformation(eventInformation);
       eventInformationId = commonDao.getEventInformationId(eventInformation);
     }
     commonDao.createOfficeHours(instructor.getId(), eventInformationId);
   }
 }
 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 Instructor update(Instructor instructor) {
    instructorVerifier.verifyOnUpdate(instructor);
    Long locationId = commonDao.provideCourseLocation(instructor.getOffice());

    instructorDao.update(instructor, locationId);

    commonDao.deleteAllOfficeHoursForInstructor(instructor.getId());
    createOfficeHours(instructor);

    return instructorDao.getById(instructor.getId());
  }
  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 Instructor create(Instructor instructor) {
   instructorVerifier.verifyOnCreate(instructor);
   Long locationId = commonDao.provideCourseLocation(instructor.getOffice());
   instructorDao.create(instructor, locationId);
   createOfficeHours(instructor);
   return instructorDao.getById(instructor.getId());
 }
  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());
  }
 public void delete(Instructor instructor) {
   instructorVerifier.verifyOnDelete(instructor);
   commonDao.deleteAllOfficeHoursForInstructor(instructor.getId());
   instructorDao.delete(instructor.getId());
 }