public string SaveFolder(Folder <string> folder) { if (folder.ID != null) { //Create with id var savedfolder = ProviderInfo.CreateFolder(folder.ID); return(ProviderInfo.ToFolder(savedfolder).ID); } if (folder.ParentFolderID != null) { var parentFolder = ProviderInfo.GetFolderById(folder.ParentFolderID); folder.Title = GetAvailableTitle(folder.Title, parentFolder, IsExist); var newFolder = ProviderInfo.CreateFolder(parentFolder.ServerRelativeUrl + "/" + folder.Title); return(ProviderInfo.ToFolder(newFolder).ID); } return(null); }