code: private int synchroizeTaskIDToHierarchy(Task parentTask, int currentID)
     {
        for (Task task : parentTask.getChildTasks())
        {
           task.setID(Integer.valueOf(currentID++));
           add(task);
           currentID = synchroizeTaskIDToHierarchy(task, currentID);
        }
        return currentID;
     }
docs: Called recursively to renumber child task IDs.
  
  @param parentTask parent task instance
  @param currentID current task ID
  @return updated current task ID