public ContentInfo GetInfo <T>()
     where T : IQPArticle
 {
     return(MappingResolver.GetContent(typeof(T).Name));
 }
        private void UpdateObjectStateEntries(IEnumerable <ObjectStateEntry> entries, Func <ContentInfo, ObjectStateEntry, string[]> getProperties, bool passNullValues)
        {
            foreach (var group in entries.Where(e => !e.IsRelationship).GroupBy(m => m.Entity.GetType().Name))
            {
                var contentName = group.Key;
                var content     = MappingResolver.GetContent(contentName);
                if (!content.IsVirtual)
                {
                    var items = group
                                .Where(item => item.Entity is IQPArticle)
                                .Select(item => {
                        var article     = (IQPArticle)item.Entity;
                        var properties  = getProperties(content, item);
                        var fieldValues = GetFieldValues(contentName, article, properties, passNullValues);

                        return(new
                        {
                            article,
                            fieldValues
                        });
                    })
                                .ToArray();

                    Cnn.MassUpdate(content.Id, items.Select(item => item.fieldValues), 1);

                    foreach (var item in items)
                    {
                        SyncArticle(item.article, item.fieldValues);
                    }
                }
            }

            var relations = (from e in entries
                             where e.IsRelationship
                             let entityKey = (EntityKey)e.CurrentValues[0]
                                             let relatedEntityKey = (EntityKey)e.CurrentValues[1]
                                                                    let entry = e.ObjectStateManager.GetObjectStateEntry(entityKey)
                                                                                let relatedEntry = e.ObjectStateManager.GetObjectStateEntry(relatedEntityKey)
                                                                                                   let id = ((IQPArticle)entry.Entity).Id
                                                                                                            let relatedId = ((IQPArticle)relatedEntry.Entity).Id
                                                                                                                            let attribute = MappingResolver.GetAttribute(e.EntitySet.Name)
                                                                                                                                            let item = new
            {
                Id = id,
                RelatedId = relatedId,
                ContentId = attribute.ContentId,
                Field = attribute.MappedName
            }
                             group item by item.ContentId into g
                             select new { ContentId = g.Key, Items = g.ToArray() }
                             )
                            .ToArray();

            foreach (var relation in relations)
            {
                var values = relation.Items
                             .GroupBy(r => r.Id)
                             .Select(g =>
                {
                    var d = g.GroupBy(x => x.Field).ToDictionary(x => x.Key, x => string.Join(",", x.Select(y => y.RelatedId)));
                    d[SystemColumnNames.Id] = g.Key.ToString();
                    return(d);
                })
                             .ToArray();

                Cnn.MassUpdate(relation.ContentId, values, 1);
            }
        }