void (final Template template) { TemplateImpl existing = getTemplate(template.getKey(), ((TemplateImpl) template).getGroupName()); if (existing != null) { LOG.info("Template with key " + template.getKey() + " and id " + template.getId() + " already registered"); TemplateGroup group = mySchemeManager.findSchemeByName(existing.getGroupName()); if (group != null) { group.removeElement(existing); if (group.isEmpty()) { mySchemeManager.removeScheme(group); } } myTemplates.remove(template.getKey(), existing); } }