public void AddSolution(Solution solution, SolutionFolder folder = null) { SolutionFolder GetParentFolder(PrimitiveProject solutionFolder) => AllSolutionFolders.FirstOrDefault(x => x.ProjectId == solutionFolder.SolutionFolder?.ProjectId); IDictionary <string, string> GetItems(SolutionFolder solutionFolder) => solutionFolder.Items.Keys .Select(x => (string)PathConstruction.GetWinRelativePath(Directory, solution.Directory / x)) .ToDictionary(x => x, x => x); solution.AllSolutionFolders.ForEach(x => AddSolutionFolder(x.Name, x.ProjectId, GetParentFolder(x) ?? folder)); solution.AllSolutionFolders.ForEach(x => GetSolutionFolder(x.ProjectId).Items = GetItems(x)); solution.AllProjects.ForEach(x => AddProject(x.Name, x.TypeId, x.Path, x.ProjectId, x.Configurations, GetParentFolder(x) ?? folder)); }