Remove unnecessary loop in TemplateRepository.getTemplate method

Remove unnecessary loop in TemplateRepository.getTemplate method