private void UpdateLocalBranches(Dictionary <string, ConfigBranch> branches, SPath path, IEnumerable <ConfigBranch> configBranches, string prefix) { foreach (var file in path.Files()) { var branchName = prefix + file.FileName; var branch = configBranches.Where(x => x.Name == branchName).Select(x => x as ConfigBranch?).FirstOrDefault(); if (!branch.HasValue) { branch = new ConfigBranch(branchName); } branches.Add(branchName, branch.Value); } foreach (var dir in path.Directories()) { UpdateLocalBranches(branches, dir, configBranches, prefix + dir.FileName + "/"); } }