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());
 }
 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);
   }
 }
  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 List<Course> getAssociatedCourses(Instructor instructor) {
   List<Course> courses = courseDao.getCoursesByInstructorId(instructor.getId());
   if (courses.size() == 0) {
     logger.warn("No courses were found for provided instructor");
   }
   return courses;
 }
  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());
 }
 public void updateInstructor(Course course, Instructor instructor) {
   courseVerifier.verifyUpdateInstructor(course, instructor);
   courseDao.updateInstructor(course.getId(), instructor.getId());
 }