Simple AMD module to create hierarchical structures from flat data