public ActionResult ChooseTemplate(PageSettingLayout PageSettingLayout)
        {
            ActionResult ActionResult = new ActionResult
            {
                Data = new ExpandoObject()
            };

            ActionResult.Data.NewTabId = PageSettingLayout.PageSettings.TabId;
            if (PageSettingLayout.PageLayout != null && PageManager.GetPages(PortalSettings.Current.ActiveTab.TabID).Count == 0)
            {
                try
                {
                    Managers.PagesManager.ApplyLayout(PortalSettings.PortalId, PageSettingLayout.PageLayout, ActionResult, false, false, true);
                    ActionResult.RedirectURL = PortalSettings.Current.ActiveTab.FullUrl;
                }
                catch (Exception ex)
                {
                    DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
                    ActionResult.AddError("", ex.Message);
                }
            }
            return(ActionResult);
        }
        public ActionResult SavePageDetails(int DefaultWorkflow, int MaxRevisions, bool Copy, PageSettingLayout PageSettingLayout)
        {
            ActionResult ActionResult;

            if (Copy)
            {
                ActionResult = Managers.PagesManager.CopyPage(DefaultWorkflow, MaxRevisions, PageSettingLayout);
            }
            else
            {
                ActionResult = Managers.PagesManager.SavePageDetails(DefaultWorkflow, MaxRevisions, PageSettingLayout);
                if (ActionResult.IsSuccess && PageSettingLayout.PageLayout != null)
                {
                    try
                    {
                        Managers.PagesManager.ApplyLayout(PortalSettings.PortalId, PageSettingLayout.PageLayout, ActionResult);
                    }
                    catch (Exception ex)
                    {
                        DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
                        ActionResult.AddError("", ex.Message);
                    }
                }
                else
                {
                    int TabID = PageSettingLayout.PageSettings.TabId;
                    if (TabID > 0 && PageManager.GetPages(TabID).Count == 0)
                    {
                        try
                        {
                            Layout layout = new Layout
                            {
                                Style       = "",
                                Content     = "",
                                ContentJSON = "",
                                StyleJSON   = ""
                            };
                            layout.Style = "";
                            Managers.PagesManager.ApplyLayout(PortalSettings.PortalId, layout, ActionResult);
                        }
                        catch (Exception ex)
                        {
                            DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
                            ActionResult.AddError("", ex.Message);
                        }
                    }
                }
            }
            return(ActionResult);
        }