private static string Execute(object model, dynamic viewBag, PageTemplateInitData initData,
                                      string razorFile, string layout, IPageTemplate pageTemplate, ISource source,
                                      IInputData input, OutputData outputData)
        {
            string engineName = pageTemplate.GetEngineName(source, input, outputData);

            IRazorEngine engine = RazorEnginePlugInFactory.CreateRazorEngine(engineName);

            string content = Task.Run(async()
                                      => await RazorExtension.CompileRenderWithLayoutAsync(engine, razorFile,
                                                                                           layout, model, initData, viewBag)).GetAwaiter().GetResult();

            return(content);
        }
        private static string Execute(IPageTemplate template, string pageTemplateName, string modelCreator,
                                      string localRazorFile, object model, dynamic viewBag, ISource source,
                                      IInputData input, OutputData outputData)
        {
            string templateFile           = template.GetTemplateFile(source, input, outputData);
            PageTemplateInitData initData = new PageTemplateInitData(pageTemplateName, modelCreator);
            string razorFile;
            string layout;

            if (string.IsNullOrEmpty(localRazorFile))
            {
                razorFile = templateFile;
                layout    = null;
            }
            else
            {
                razorFile = localRazorFile;
                layout    = templateFile;
            }
            return(Execute(model, viewBag, initData, razorFile, layout, template, source, input, outputData));
        }