A way to turn child/parent pairs into a tree structure