private void AddContentValues(ILocalizableContentModel content, string propertyKey, IEnumerable <object> invariantValues)
        {
            var view = content.ViewFor(CultureInfo.InvariantCulture);

            foreach (var value in invariantValues)
            {
                view.AddValue(propertyKey, value);
            }
        }
 private void AddContentValue(ILocalizableContentModel content, string propertyKey, object englishValue, object dutchValue)
 {
     content.ViewFor(_englishCulture).AddValue(propertyKey, englishValue);
     content.ViewFor(_dutchCulture).AddValue(propertyKey, dutchValue);
 }
 private void AddContentValue(ILocalizableContentModel content, string propertyKey, object invariantValue)
 {
     content.ViewFor(CultureInfo.InvariantCulture).AddValue(propertyKey, invariantValue);
 }
        private async Task <NodeId> CreatePageAsync(IServiceProvider serviceProvider, SeederContext context, NodeId parentId, ILocalizableContentModel content, string englishName, string dutchName, int sortOrder, string viewName = null)
        {
            var commandBus     = serviceProvider.GetRequiredService <ICommandBus>();
            var contentService = serviceProvider.GetRequiredService <IContentService>();

            this.AddContentValue(content, nameof(PageBase.PageTitle), englishName, dutchName);
            if (typeof(SimplePage).IsAssignableFrom(content.ContentType.ViewModelType))
            {
                this.AddContentValue(content, nameof(ContentPage.HeadingIntro), Lorem.Paragraph(8, 16, 3, 5), Lorem.Paragraph(8, 16, 3, 5));
                this.AddContentValue(content, nameof(ContentPage.HeadingCaption), Lorem.Words(3, 6), Lorem.Words(3, 6));
            }

            // Events
            var nodeId    = NodeId.New;
            var versionId = NodeVersionId.New;
            var contentId = await contentService.CreateContentAsync(content.ContentType, content).NoSync();

            await commandBus.PublishAsync(new Redakt.ContentManagement.Nodes.Commands.CreateNode(nodeId, content.ContentType, englishName, parentId, sortOrder));

            await commandBus.PublishAsync(new Redakt.ContentManagement.Nodes.Commands.SetNodeView(nodeId, viewName ?? content.ContentType.AllowedViewNames.First()));

            await commandBus.PublishAsync(new Redakt.ContentManagement.Nodes.Commands.AddNodeVersion(nodeId, versionId, contentId, "Version 1", NodeVersionStateKey.New));

            await commandBus.PublishAsync(new Redakt.ContentManagement.Nodes.Commands.PublishNode(nodeId, _englishCulture, versionId, englishName.UrlFriendly()));

            await commandBus.PublishAsync(new Redakt.ContentManagement.Nodes.Commands.PublishNode(nodeId, _dutchCulture, versionId, dutchName.UrlFriendly()));

            return(nodeId);
        }