Template preSeq = config.getEndpointTemplates().get(templateName);
if (preSeq == null) {
handleException("Unable to save template " + templateName + ". Does not exist");
} else {
// we should first try to build the new sequence. if exception we return
Template endpointTemplate = new TemplateFactory().createEndpointTemplate(
templateElement, getSynapseConfiguration().getProperties());
// if everything went successfully we remove the sequence
config.removeEndpointTemplate(templateName);
if (endpointTemplate instanceof Template) {