private async Task <List <string> > DeleteComponent(IEnumerable <string> nodeIds) { List <string> errorIds = new List <string>(); foreach (var nodeId in nodeIds) { try { var nodeInfo = await _alfrescoHttpClient.GetNodeInfo(nodeId, ImmutableList <Parameter> .Empty .Add(new Parameter(AlfrescoNames.Headers.Include, AlfrescoNames.Includes.Path, ParameterType.QueryString))); if (nodeInfo?.Entry?.Path?.Name?.StartsWith(AlfrescoNames.Prefixes.Path + SpisumNames.Paths.Components, StringComparison.OrdinalIgnoreCase) != true) { throw new Exception(); } var componentParent = await _alfrescoHttpClient.GetNodeParents(nodeId, ImmutableList <Parameter> .Empty .Add(new Parameter(AlfrescoNames.Headers.Include, AlfrescoNames.Includes.Properties, ParameterType.QueryString)) .Add(new Parameter(AlfrescoNames.Headers.Where, $"(assocType='{SpisumNames.Associations.Components}')", ParameterType.QueryString)) .Add(new Parameter(AlfrescoNames.Headers.MaxItems, "1", ParameterType.QueryString))); await _alfrescoHttpClient.DeleteNode(nodeId, ImmutableList <Parameter> .Empty .Add(new Parameter(AlfrescoNames.Headers.Permanent, true, ParameterType.QueryString))); await UpdateAssociationCount(componentParent?.List?.Entries?.FirstOrDefault()?.Entry?.Id); } catch { errorIds.Add(nodeId); } } return(errorIds); }