From http://blog.devontechnologies.com/2013/09/build-group-hierarchies-with-templates/