docs: public Deferred<Integer> createNewTree(final TSDB tsdb) {
      if (tree_id > 0) {
        throw new IllegalArgumentException("Tree ID has already been set");
      }
      if (name == null || name.isEmpty()) {
        throw new IllegalArgumentException("Tree was missing the name");
      }
      
      /**
       * Called after a successful CAS to store the new tree with the new ID.
       * Returns the new ID if successful, 0 if there was an error
       */
      final class CreatedCB implements Callback<Deferred<Integer>, Boolean> {
        
        @Override
        public Deferred<Integer> call(final Boolean cas_success) 
          throws Exception {
          return Deferred.fromResult(tree_id);
        }
        
      }
      
      /**
       * Called after fetching all trees. Loops through the tree definitions and
       * determines the max ID so we can increment and write a new one
       */
      final class CreateNewCB implements Callback<Deferred<Integer>, List<Tree>> {
  
        @Override
        public Deferred<Integer> call(List<Tree> trees) throws Exception {
          int max_id = 0;
          if (trees != null) {
            for (Tree tree : trees) {
              if (tree.tree_id > max_id) {
                max_id = tree.tree_id;
              }
            }
          }
          
          tree_id = max_id + 1;
          if (tree_id > 65535) {
            throw new IllegalStateException("Exhausted all Tree IDs");
          }
          
          return storeTree(tsdb, true).addCallbackDeferring(new CreatedCB());
        }
        
      }
      
      // starts the process by fetching all tree definitions from storage
      return fetchAllTrees(tsdb).addCallbackDeferring(new CreateNewCB());
    }