public async Task <bool> SaveURIFirstDocAsync() { bool bHasSavedDoc = false; if (string.IsNullOrEmpty(_dtoContentURI.URIClub.ClubDocFullPath)) { //when the file path is not set, too much data is prevented return(true); } bool bSaveInFileSystemContent = true; bool bHasSet = await SetURINetwork(_dtoContentURI, bSaveInFileSystemContent); XElement root = XmlLinq.GetRootXmlDoc(); bool bHasGoodDoc = false; if (_dtoContentURI.URINodeName == Networks.NETWORK_BASE_TYPES.networkbasegroup.ToString()) { bHasGoodDoc = await AddDescendants(_dtoContentURI.URIId, _dtoContentURI.URINodeName, root); } else if (_dtoContentURI.URINodeName == Networks.NETWORK_BASE_TYPES.networkbase.ToString()) { //all content starts with group nodes bHasGoodDoc = await AddAncestors(root); if (bHasGoodDoc) { bHasGoodDoc = await AddDescendants(_dtoContentURI.URIId, _dtoContentURI.URINodeName, root.Descendants(Networks.NETWORK_BASE_TYPES.networkbasegroup.ToString()).Last()); } } else if (_dtoContentURI.URINodeName == Networks.NETWORK_TYPES.networkaccountgroup.ToString()) { bHasGoodDoc = await AddDescendants(_dtoContentURI.URIId, _dtoContentURI.URINodeName, root); } else if (_dtoContentURI.URINodeName == Networks.NETWORK_TYPES.network.ToString()) { //all content starts with group nodes bHasGoodDoc = await AddAncestors(root); if (bHasGoodDoc) { //add the descendants to the last ancestor added bHasGoodDoc = await AddDescendants(_dtoContentURI.URIId, _dtoContentURI.URINodeName, root.Descendants(Networks.NETWORK_TYPES.networkaccountgroup.ToString()).Last()); } } if (bHasGoodDoc) { bHasSavedDoc = await EditModelHelper.SaveStandardContentXmlDocAsync(_dtoContentURI, root); } else { //add an error message _dtoContentURI.ErrorMessage = DevTreks.Exceptions.DevTreksErrors.MakeStandardErrorMsg( string.Empty, "MODELHELPERS_BADXMLCONTENT"); } return(bHasSavedDoc); }