private ResourceFile getResourceFileFor(Identifier templateId) {
   for (ResourceFile file : templateResources) {
     if (file.getFileName().endsWith("/" + templateId.getId() + ".template")) {
       return file;
     }
   }
   throw new IllegalStateException("No resource found for templateId " + templateId.getId());
 }
 private <T> T loadTemplate(ResourceFile file, TemplateLoader<T> loader) {
   InputStream inputStream = null;
   try {
     inputStream = file.getURL().openStream();
     return loader.load(inputStream);
   } catch (IOException e) {
     throw new AnathemaException(e);
   } finally {
     IOUtils.closeQuietly(inputStream);
   }
 }