/// <summary>
 /// A collection links that belong to this base asset filtered by the passed in filter
 /// </summary>
 public ICollection<Link> GetLinks(LinkFilter filter) {
     filter = filter ?? new LinkFilter();
     filter.Asset.Clear();
     filter.Asset.Add(this);
     return Instance.Get.Links(filter);
 }
        private void ProcessChangeSetInfo(ChangeSetInfo info)
        {
            // Find related work items
            var work_items = new List<PrimaryWorkitem>();
            foreach (string refe in info.References)
            {
                var wi = _v1.Get.PrimaryWorkitemByDisplayID(refe);
                if (wi == null) {
                    // Let's see if this is a secondary work item
                    var sec_wi = _v1.Get.SecondaryWorkitemByDisplayID(refe);
                    if (sec_wi != null) {
                        wi = sec_wi.Parent;
                    } else {
                        // We can't find it, let's just get out of here
                        return;
                    }
                }
                work_items.Add(wi);
            }

            // Find or create the changeset asset
            var cs_filter = new ChangeSetFilter();
            cs_filter.Reference.Add(info.Revision);
            var change_sets = _v1.Get.ChangeSets(cs_filter);
            string cs_name = string.Format("'{0}' on '{1}' - {2}", info.Author, TimeZone.CurrentTimeZone.ToLocalTime(info.ChangeDate), info.Message);
            string cs_ref = string.Format("{0} - {1}", info.ReposName, info.Revision);
            if (change_sets.Count == 0)
            {
                change_sets = new List<ChangeSet>();
                var cs = _v1.Create.ChangeSet(info.Message, cs_ref);
                change_sets.Add(cs);
            }

            //Update changeset asset
            foreach (ChangeSet cs in change_sets)
            {
                foreach (var wi in work_items)
                {
                    cs.PrimaryWorkitems.Add(wi);
                    cs.Name = cs_name;
                    cs.Reference = cs_ref;
                }
            }

            // Find or create the links to the work item
            var link_url = string.Format(info.ReferenceUrl, info.Revision);
            var link_name = string.Format(_linkinfo.Name, info.Revision);
            var link_filter = new LinkFilter();
            link_filter.URL.Add(link_url);
            foreach (var wi in work_items)
            {
                var links = wi.GetLinks(link_filter);
                if (links.Count > 0)
                {
                    continue;
                }
                wi.CreateLink(link_name, link_url, true);
            }
        }