code: private void writeTask(Task task) throws IOException
     {
        writeFields(null, task, TaskField.values());
        for (Task child : task.getChildTasks())
        {
           writeTask(child);
        }
     }
docs: This method is called recursively to write a task and its child tasks
  to the JSON file.
  
  @param task task to write