public void Save(Document project, bool commit = true, string message = null) { var repositoryService = GetRepositoryService(project); var path = Path.Combine(Root, project.User.Path, project.Name); if (project.Disconnect) { if (!System.NodeExists(path)) { System.CreateNode(path); } } else { if (!repositoryService.IsRepo(path)) { gitHubService.Create(project); } if (System.NodeExists(path)) { repositoryService.Pull(path); } else { repositoryService.Clone(gitHubService.GetRepoName(project), path); } } EmptyProject(path); SaveDirectory(project, Path.Combine(Root, project.Path), true); if (message == null) { message = DateTime.Now.ToString(); } if (!project.Disconnect && commit) { repositoryService.Commit(path, message); } }