private Contracts.Entity ToContract() { var obj = new Contracts.Entity { Id = Id, Type = ToString(Type), Labels = ToContract(_Labels), Aliases = ToContract(_Aliases), Descriptions = ToContract(_Descriptions), Sitelinks = SiteLinks.ToDictionary(link => link.Site, link => new Contracts.SiteLink { Site = link.Site, Title = link.Title, Badges = link.Badges.ToList() }), Claims = Claims.GroupBy(c => c.MainSnak.PropertyId).ToDictionary(g => g.Key, g => (ICollection <Contracts.Claim>)g.Select(c => c.ToContract(false)).ToList()) }; return(obj); }