private void validateMilestoneMatchesProduct(Task task, Errors errors) {

    for (Milestone productMilestone : task.getProduct().getMilestones()) {
      if (productMilestone.getValue().equals(task.getTargetMilestone())) {
        return;
      }
    }
    // FIXME TASK 168
    // errors.rejectValue("targetMilestone", "milestoneDoesNotMatchProduct");
  }
  private void validateCycleFree(Task task, Errors errors) {
    Queue<Task> queue = new LinkedList<Task>();

    for (Dependency dep : task.getDependenciesesForBlocked()) {
      queue.add(dep.getBugsByDependson());
    }

    while (!queue.isEmpty()) {
      Task node = entityManager.find(Task.class, queue.remove().getId());
      if (node.getId().equals(task.getId())) {
        errors.reject("task.dependency.cycle");
        return;
      }

      entityManager.refresh(node);

      for (Dependency dep : node.getDependenciesesForBlocked()) {
        queue.add(dep.getBugsByDependson());
      }
    }
  }