private WorkItemCollection GetWorkItemsFromQuery(TfsWorkItemMigrationClient wiClient)
        {
            var startTime = DateTime.UtcNow;
            var timer     = System.Diagnostics.Stopwatch.StartNew();
            WorkItemCollection results;

            try
            {
                results = wiClient.Store.Query(Query);
                timer.Stop();
                Telemetry.TrackDependency(new DependencyTelemetry("TfsObjectModel", MigrationClient.Config.AsTeamProjectConfig().Collection.ToString(), "GetWorkItemsFromQuery", null, startTime, timer.Elapsed, "200", true));
            }
            catch (Exception ex)
            {
                timer.Stop();
                Telemetry.TrackDependency(new DependencyTelemetry("TfsObjectModel", MigrationClient.Config.AsTeamProjectConfig().Collection.ToString(), "GetWorkItemsFromQuery", null, startTime, timer.Elapsed, "500", false));
                Telemetry.TrackException(ex,
                                         new Dictionary <string, string> {
                    { "CollectionUrl", wiClient.Store.TeamProjectCollection.Uri.ToString() }
                },
                                         new Dictionary <string, double> {
                    { "QueryTime", timer.ElapsedMilliseconds }
                });
                Log.Error(ex, " Error running query");
                throw;
            }
            return(results);
        }
        private IList <WorkItem> GetWorkItemsFromQuery(TfsWorkItemMigrationClient wiClient)
        {
            var                startTime = DateTime.UtcNow;
            var                timer     = System.Diagnostics.Stopwatch.StartNew();
            List <WorkItem>    results   = new List <WorkItem>();
            WorkItemCollection workItemCollection;

            try
            {
                workItemCollection = wiClient.Store.Query(Query);
                foreach (WorkItem item in workItemCollection)
                {
                    try
                    {
                        if (!string.IsNullOrEmpty(item.Title)) // Force to read WI
                        {
                            results.Add(item);
                        }
                    }
                    catch (DeniedOrNotExistException ex)
                    {
                        Log.Error(ex, "Deleted Item detected.");
                    }
                }
                timer.Stop();
                Telemetry.TrackDependency(new DependencyTelemetry("TfsObjectModel", MigrationClient.Config.AsTeamProjectConfig().Collection.ToString(), "GetWorkItemsFromQuery", null, startTime, timer.Elapsed, "200", true));
            }
            catch (Exception ex)
            {
                timer.Stop();
                Telemetry.TrackDependency(new DependencyTelemetry("TfsObjectModel", MigrationClient.Config.AsTeamProjectConfig().Collection.ToString(), "GetWorkItemsFromQuery", null, startTime, timer.Elapsed, "500", false));
                Telemetry.TrackException(ex,
                                         new Dictionary <string, string> {
                    { "CollectionUrl", wiClient.Store.TeamProjectCollection.Uri.ToString() }
                },
                                         new Dictionary <string, double> {
                    { "QueryTime", timer.ElapsedMilliseconds }
                });
                Log.Error(ex, " Error running query");
                throw;
            }
            return(results);
        }