Adding template recursion for sections

Change-Id: I9471bedf7fcd06bd7daa77712e1169721f3889b2