private async Task <IEnumerable <MigratedWorkItem> > QueryWorkItemsAsync(MigrationContext context, QuerySettings query, CancellationToken cancellationToken) { //Execute the query on the source server to get the WIs and their children var sourceProject = await context.GetSourceProjectAsync(cancellationToken).ConfigureAwait(false); var existingQuery = await context.SourceService.GetQueryAsync(sourceProject, query.Name, true, cancellationToken).ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); //Execute the query var workItems = await context.SourceService.QueryAsync(existingQuery.Id, cancellationToken).ConfigureAwait(false); Logger.Debug($"Query '{query.Name}' returned {workItems?.Count() ?? 0} items"); return(from wi in workItems select new MigratedWorkItem() { SourceId = wi.Id }); }