public EntityModified Execute(SolutionEntity solutionEntity) { Repo.SaveAllDiagrams(); var modified = from currentDiagram in GetCurrentDiagramContaining(solutionEntity) from solution in SolutionInstantiationGraph.Create(Repo, solutionEntity) let solutionTree = solution.Graph.ToTree(DirectedLabeledGraph.TraverseEdgeOnlyOnce <ModelEntity.Connector>()) let preMarkedSolutionTree = SelectRootWithAlternatives(solutionTree) from markedSolutionTree in Selector.GetSelectedDependencies(preMarkedSolutionTree) let markedSolution = solution.WithSelection(markedSolutionTree.NodeLabels) let targetPackage = Repo.FindPackageContaining(solutionEntity) let instantiatedSolution = markedSolution.InstantiateSelectedItems(targetPackage) let _1 = instantiatedSolution.InstantiateMissingSolutionConnectors() let _2 = instantiatedSolution.CreateDiagramElements(currentDiagram) select EntityModified.Modified; return(modified.GetOrElse(EntityModified.NotModified)); }