public List <WorkItem> PageWorkitemsByIds(StoredQuery query, List <int> ids)
        {
            if (ids.Count > 50)
            {
                throw new Exception("Page only by 50");
            }
            var invoker = new SoapInvoker(this);
            var msg     = invoker.CreateEnvelope("PageWorkitemsByIds", headerName);

            msg.Header.Add(GetHeaderElement());
            msg.Body.Add(new XElement(MessageNs + "ids", ids.Select(i => new XElement(MessageNs + "int", i))));
            var columns = query.GetSelectColumns();
            var fields  = CachedMetaData.Instance.Fields.GetFieldsByNames(columns);

            if (fields["System.Id"] == null) //If No id Exists add it
            {
                fields.Insert(0, CachedMetaData.Instance.Fields["System.Id"]);
            }
            msg.Body.Add(new XElement(MessageNs + "columns", fields.Where(f => !f.IsLongField).Select(c => new XElement(MessageNs + "string", c.ReferenceName))));
            msg.Body.Add(new XElement(MessageNs + "longTextColumns", fields.Where(f => f.IsLongField).Select(c => new XElement(MessageNs + "int", c.Id))));
            var             response  = invoker.InvokeResponse();
            var             extractor = new TableDictionaryExtractor(response, "Items");
            var             data      = extractor.Extract();
            List <WorkItem> list      = new List <WorkItem>();

            foreach (var item in data)
            {
                list.Add(new WorkItem {
                    WorkItemInfo = item
                });
            }
            return(list);
        }
        public WorkItem GetWorkItem(int id)
        {
            var invoker = new SoapInvoker(this);
            var msg     = invoker.CreateEnvelope("GetWorkItem", headerName);

            msg.Header.Add(GetHeaderElement());
            msg.Body.Add(new XElement(MessageNs + "workItemId", id));
            var response  = invoker.InvokeResponse();
            var extractor = new TableDictionaryExtractor(response, "WorkItemInfo");
            var workItem  = new WorkItem();
            //workItem.Id = id;
            var data = extractor.Extract().Single();

            workItem.WorkItemInfo = new Dictionary <string, object>();
            foreach (var item in data)
            {
                workItem.WorkItemInfo.Add(item.Key, item.Value);
            }
            return(workItem);
        }