get_tree method for categories class