public Backlog GetBacklog(string queryId, bool withBugs) { var result = new Backlog(); Action <WorkItemReference> AddElement = (targetElementLink) => { if (targetElementLink == null) { return; } var targetElement = WitClient.GetWorkItemAsync(targetElementLink.Id, expand: WorkItemExpand.All).Result; if (targetElement.Fields["System.WorkItemType"].ToString() == "User Story") { result.AddUserStory(targetElement); } if (targetElement.Fields["System.WorkItemType"].ToString() == "Eco Task") { result.AddWorkItem(targetElement); } if (withBugs && targetElement.Fields["System.WorkItemType"].ToString() == "eco Bug") { result.AddWorkItem(targetElement); } }; Verbose("Loading Backlog to structure"); var items = WitClient.QueryByIdAsync(new Guid(queryId)).Result; items.WorkItemRelations.ForEach(item => { AddElement(item.Target); AddElement(item.Source); }); //it cannot be paraller because sometimes we can add task without adding pant //Parallel.ForEach(items.WorkItemRelations, item => // { // AddElement(item.Target); // AddElement(item.Source); // }); return(result); }