/**
  * Add reminders for a specific appointment
  *
  * @param appointment Appointment object with the necessary fields populated
  */
 @Override
 public void addReminders(Appointment appointment) {
   if (appointment.getReminderInterval() != null) {
     RepeatingPeriodSchedulableJob reminder = buildJob(appointment);
     this.schedulerService.safeScheduleRepeatingPeriodJob(reminder);
   }
 }
  /**
   * Helper to create a repeating schedulable job from an appointment
   *
   * @param appointment The appointment object to create the schedulable job for
   * @return a repeating period job for the scheduler
   */
  private RepeatingPeriodSchedulableJob buildJob(Appointment appointment) {
    String eventTitle =
        String.format(SUBJECT, appointment.getExternalId(), appointment.getApptId());
    MotechEvent event = new MotechEvent(eventTitle);

    return new RepeatingPeriodSchedulableJob(
        event,
        appointment.getReminderStartTime().toDate(),
        appointment.getAppointmentDate().toDate(),
        appointment.getReminderInterval(),
        true);
  }