Templating with nested models