Own methods to sort and build a catalog tree.