Hierarchical sorting function update. Display children without parents at parents' level (useful for drafts, trash etc.)