/// <summary>
        /// Checks that a custom entity definition exists if it is required by the tempate. This
        /// can cause a DbContext.SaveChanges to run.
        /// </summary>
        private Task EnsureCustomEntityDefinitionExistsAsync(
            PageTemplateFileInfo fileTemplateDetails,
            PageTemplate dbPageTemplate,
            IExecutionContext executionContext
            )
        {
            var definitionCode = fileTemplateDetails.CustomEntityDefinition?.CustomEntityDefinitionCode;

            // Only update/check the definition if it has changed to potentially save a query
            if (!string.IsNullOrEmpty(definitionCode) && (dbPageTemplate == null || definitionCode != dbPageTemplate.CustomEntityDefinitionCode))
            {
                var command = new EnsureCustomEntityDefinitionExistsCommand(fileTemplateDetails.CustomEntityDefinition.CustomEntityDefinitionCode);
                return(_commandExecutor.ExecuteAsync(command, executionContext));
            }

            return(Task.CompletedTask);
        }
        public Task EnsureExistsAsync(string customEntityDefinitionCode)
        {
            var command = new EnsureCustomEntityDefinitionExistsCommand(customEntityDefinitionCode);

            return(ExtendableContentRepository.ExecuteCommandAsync(command));
        }