public static Task task(Profile profile) {
   Task task = new Task();
   task.setTaskCreator(profile);
   task.generateGUIDKey();
   task.setTitle(factory.getStrategy().getStringOfLength(50));
   return task;
 }
  @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;
  }
  public static Invite invite(Task task, Map<String, String> emails) {
    Invite invite = new Invite();
    invite.setMessage(factory.getStrategy().getStringValue());
    invite.setSubject(factory.getStrategy().getStringValue());
    invite.setShareId(task.getId());
    invite.setShareClassName(Task.class.getName());
    invite.setInviter(task.getTaskCreator().getMember());

    invite.setDirectLink("http://reminded.me");
    invite.setNotificationType(NotificationTypeEnum.EMAIL.ordinal());

    invite.setEmailAddresses(emails);

    return invite;
  }
 public static Alarm alarm(Task task, DateTime alarmTime) {
   return alarm(task, task.getTaskCreator().getMember(), alarmTime);
 }