public TopologyTemplate createTopologyTemplate(
      Topology topology, String name, String description, String version) {
    String topologyId = UUID.randomUUID().toString();
    topology.setId(topologyId);

    String topologyTemplateId = UUID.randomUUID().toString();
    TopologyTemplate topologyTemplate = new TopologyTemplate();
    topologyTemplate.setId(topologyTemplateId);
    topologyTemplate.setName(name);
    topologyTemplate.setDescription(description);

    topology.setDelegateId(topologyTemplateId);
    topology.setDelegateType(TopologyTemplate.class.getSimpleName().toLowerCase());

    save(topology);
    this.alienDAO.save(topologyTemplate);
    if (version == null) {
      topologyTemplateVersionService.createVersion(topologyTemplateId, null, topology);
    } else {
      topologyTemplateVersionService.createVersion(
          topologyTemplateId, null, version, null, topology);
    }

    return topologyTemplate;
  }
 /**
  * Assign an id to the topology, save it and return the generated id.
  *
  * @param topology
  * @return
  */
 public String saveTopology(Topology topology) {
   String topologyId = UUID.randomUUID().toString();
   topology.setId(topologyId);
   save(topology);
   return topologyId;
 }