if (element instanceof Element) {
final Template template = readExternal((Element) element, templateName);
final String key = template.getKey();
// Only add if not present
if (key != null && templateSettings.getTemplate(key) == null) {
templateSettings.addTemplate(template);
}
}
}
} catch (Exception e) {
e.printStackTrace();