public static void RegisterContentItem <TContentItem>(this ModelBuilder modelBuilder, ILogger <BioContext> logger)
            where TContentItem : class, IContentItem
        {
            logger.LogInformation("Register content item type {type} - {entityType}",
                                  EntityExtensions.GetKey <TContentItem>(),
                                  typeof(TContentItem));
            if (_requireArrayConversion)
            {
                modelBuilder.RegisterSiteEntityConversions <TContentItem>();
                modelBuilder.RegisterSectionEntityConversions <TContentItem>();
            }

            modelBuilder.RegisterEntity <TContentItem>();
            modelBuilder.Entity <TContentItem>().Property(i => i.Title).IsRequired();
            modelBuilder.Entity <TContentItem>().Property(i => i.Url).IsRequired();
            modelBuilder.Entity <TContentItem>().Ignore(i => i.Blocks);
            modelBuilder.Entity <TContentItem>().Ignore(i => i.Sections);
            modelBuilder.Entity <TContentItem>().Ignore(i => i.Tags);
            modelBuilder.Entity <TContentItem>().Ignore(i => i.PublicRouteName);
            modelBuilder.Entity <TContentItem>().HasIndex(i => i.SiteIds);
            modelBuilder.Entity <TContentItem>().HasIndex(i => i.TagIds);
            modelBuilder.Entity <TContentItem>().HasIndex(i => i.SectionIds);
            modelBuilder.Entity <TContentItem>().HasIndex(i => i.IsPublished);
            modelBuilder.Entity <TContentItem>().HasIndex(i => i.Url).IsUnique();
        }
        public static void RegisterEntity <TEntity>(this ModelBuilder modelBuilder) where TEntity : class, IEntity
        {
            modelBuilder.Entity <TEntity>();
            var key = EntityExtensions.GetKey <TEntity>();

            if (!Entities.ContainsKey(key))
            {
                Entities.TryAdd(key, typeof(TEntity));
            }
        }
        public static void RegisterContentBlock <TBlock, TBlockData>(this ModelBuilder modelBuilder, ILogger logger)
            where TBlock : ContentBlock <TBlockData> where TBlockData : ContentBlockData, new()
        {
            var key = EntityExtensions.GetKey <TBlock>();

            logger.LogInformation(
                "Register content block type {type} - {entityType} ({dataType})", key,
                typeof(TBlock),
                typeof(TBlockData));
            modelBuilder.RegisterDiscriminator <ContentBlock, TBlock>(key);
            modelBuilder.RegisterDataConversion <TBlock, TBlockData>();
            if (!BlockTypes.ContainsKey(key))
            {
                BlockTypes.TryAdd(key, typeof(TBlock));
            }
        }
        public static void RegisterSection <TSection, TSectionData>(this ModelBuilder modelBuilder,
                                                                    ILogger <BioContext> logger)
            where TSection : Section <TSectionData> where TSectionData : ITypedData, new()
        {
            var key = EntityExtensions.GetKey <TSection>();

            logger.LogInformation("Register section type {type} - {entityType} ({dataType})", key,
                                  typeof(TSection),
                                  typeof(TSectionData));
            modelBuilder.RegisterEntity <TSection>();
            modelBuilder.RegisterDiscriminator <Section, TSection>(key);
            modelBuilder.RegisterDataConversion <TSection, TSectionData>();
            if (_requireArrayConversion)
            {
                modelBuilder.RegisterSiteEntityConversions <TSection>();
            }
        }