private static ApplicationModelProviderContext GetContext(
            Type type,
            IModelMetadataProvider modelMetadataProvider = null)
        {
            var context    = new ApplicationModelProviderContext(new[] { type.GetTypeInfo() });
            var mvcOptions = Options.Create(new MvcOptions());

            modelMetadataProvider = modelMetadataProvider ?? new EmptyModelMetadataProvider();
            var convention = new DefaultApplicationModelProvider(mvcOptions, modelMetadataProvider);

            convention.OnProvidersExecuting(context);

            return(context);
        }
        private static ApplicationModelProviderContext GetContext(
            Type type,
            IModelMetadataProvider modelMetadataProvider = null)
        {
            var context    = new ApplicationModelProviderContext(new[] { type.GetTypeInfo() });
            var mvcOptions = Options.Create(new MvcOptions {
                AllowValidatingTopLevelNodes = true
            });

            modelMetadataProvider = modelMetadataProvider ?? new EmptyModelMetadataProvider();
            var provider = new DefaultApplicationModelProvider(mvcOptions, modelMetadataProvider);

            provider.OnProvidersExecuting(context);

            return(context);
        }