Sort the order of pages by child level to ensure parents are created first.