public async Task <IReadOnlyList <T> > WiqlQuery <T>(string wiql, bool fullyPopulate, Func <JToken, T> fromToken) where T : JsonWorkItem { const string format = " \"query\": \"{0}\" "; string body = "{" + String.Format(format, wiql) + "}"; var exchange = StructuredHttpExchange.Post("/wit/wiql", body); JsonParsers.QueryResult <T> result = await ProcessCollectionRequest(exchange, o => JsonParsers.WiqlQueryParse(o, fromToken)); var retVal = new List <T>(); if (fullyPopulate) { List <int> ids = result.Items.Select(workItem => workItem.Id).ToList(); Task <IReadOnlyList <T> > populated = JsonWorkItemsLoader(ids, result.TimeStamp, fromToken); retVal.AddRange(populated.Result); } else { foreach (T item in result.Items) { retVal.Add(item); } } return(retVal); }