@Transactional
  public RepeatSetup createRepeatSetup(RepeatSetup repeatSetup) throws ValidationException {
    // validator to make sure required fields are set
    validator.validateRepeatSetup(repeatSetup);

    // need to load the task
    Task task = taskService.getTaskById(repeatSetup.getClonedTask().getId());
    if (task == null)
      throw new ValidationException(ValidationCodeEnum.CLONED_TASK_ID_IS_NULL_OR_NOT_FOUND);

    // now clone the task
    //		repeatSetup.setClondedTaskAsTask(task);

    TaskTemplate taskTemplate = new TaskTemplate(task);
    repeatSetupDao.createTaskTemplate(taskTemplate);

    repeatSetup.setClonedTask(taskTemplate);

    // now we can save the object
    repeatSetupDao.createRepeatSetup(repeatSetup);

    // check to see if the task has the revese repeat setup attached.  This is done because of how
    // the sync framework sends repeats
    if (task.getRepeatSetup() == null
        || !task.getRepeatSetup().getId().equals(repeatSetup.getId())) {
      task.setRepeatSetup(repeatSetup);
      taskDao.updateTask(task);
    }

    return repeatSetup;
  }
  @Transactional
  public RepeatSetup updateRepeatSetup(RepeatSetup repeatSetup, String profileId)
      throws ValidationException {
    // check to make sure required fields are set
    validator.validateRepeatSetup(repeatSetup);

    RepeatSetup repeatSetupFromDB = repeatSetupDao.getRepeatSetupByID(repeatSetup.getId());
    if (repeatSetupFromDB == null) return createRepeatSetup(repeatSetupFromDB);

    if (profileId == null || !repeatSetupFromDB.getMember().getEmail().equalsIgnoreCase(profileId))
      return repeatSetup;

    validator.validateSynchronizationUpdate(repeatSetup, repeatSetupFromDB);
    repeatSetup.setModifiedDateZone(new DateTime());

    repeatSetupDao.updateRepeatSetup(repeatSetupFromDB);

    return repeatSetup;
  }