add all tree-based build logic to CategoryTree