const sortedRootElements = tagHierarchy
    .filter(e => e.parent === parent)
    .sort((a, b) => (a.index < b.index ? 1 : (a.index === b.index ? 0 : -1)));