implemented recursive template parsing

entity templates are structured in a heirachy necessitating recursive
parsing of each template and its parent template.