Small re-factoring in template_resource

Change-Id: Id416595c531db8510d9fd88d1573372f3c4934eb
Merge "Small re-factoring in template_resource"