Add template support to extension method