public async Task <Post> GetPostById([FromBody] int postId)
 {
     try
     {
         DynamicComponentController controller = new DynamicComponentController();
         return(await controller.GetPostById(postId, GetSiteID));
     }
     catch (Exception ex)
     {
         ProcessException(ex);
         return(null);
     }
 }
        public async Task <IActionResult> PostData()
        {
            string id = string.Empty;

            if (QueryParameters != null && QueryParameters.Length > 0)
            {
                id = QueryParameters[0].ToString();
            }
            int ptid = 0;

            int.TryParse(id, out ptid);
            Post post = null;
            DynamicComponentController controller = new DynamicComponentController();

            if (ptid > 0)
            {
                post = await controller.GetPostById(ptid, GetSiteID);
            }
            else
            {
                post = await controller.GetPostByPostKey(id, GetSiteID);
            }
            if (post == null)
            {
                throw new Exception("No Post found");
            }
            else
            {
                AddJS("postData", "/DynamicPost/PostData/js/PostData.js");
                AddJS("FBUserData", "/DynamicPost/PostData/js/FBUserData.js");
                AddJS("formbuilder", "/DynamicPost/Assets/formbuilder/form-builder.min.js");
                AddJS("formbuilder_extras", "/DynamicPost/Assets/formbuilder/sageMedia.es5.js");
                AddJS("formbuilder_sageIcon", "/DynamicPost/Assets/formbuilder/sageIcon.es5.js");
                AddJS("formbuilder_richtext", "/DynamicPost/Assets/formbuilder/richtext.es5.js");
                AddJS("formbuilder_sageVideo", "/DynamicPost/Assets/formbuilder/sageVideo.es5.js");
                AddJS("formbuilder_sageUrl", "/DynamicPost/Assets/formbuilder/sageUrl.es5.js");
                AddJS("formrender", "/DynamicPost/Assets/formbuilder/form-render.min.js");
                AddJS("SageMediaManagement", "/cbuilderassets/js/SageMediaManagement.js");

                return(View(post));
            }
        }