public HttpResponseMessage Update(JObject json)
        {
            try
            {
                int ModuleId = ActiveModule.ModuleID;
                OpenContentController ctrl = new OpenContentController();
                var content = ctrl.GetFirstContent(ModuleId);
                if (content == null)
                {
                    content = new OpenContentInfo()
                    {
                        ModuleId = ModuleId,
                        Title = json["form"]["Title"] == null ? ActiveModule.ModuleTitle : json["form"]["Title"].ToString(),
                        Json = json["form"].ToString(),
                        CreatedByUserId = UserInfo.UserID,
                        CreatedOnDate = DateTime.Now,
                        LastModifiedByUserId = UserInfo.UserID,
                        LastModifiedOnDate = DateTime.Now,
                        Html = "",
                    };
                    ctrl.AddContent(content);
                }
                else
                {
                    content.Title = json["form"]["Title"] == null ? ActiveModule.ModuleTitle : json["form"]["Title"].ToString();
                    content.Json = json["form"].ToString();
                    content.LastModifiedByUserId = UserInfo.UserID;
                    content.LastModifiedOnDate = DateTime.Now;
                    ctrl.UpdateContent(content);
                }
                if (json["form"]["ModuleTitle"] != null && json["form"]["ModuleTitle"].Type == JTokenType.String)
                {
                    string ModuleTitle = json["form"]["ModuleTitle"].ToString();
                    OpenContentUtils.UpdateModuleTitle(ActiveModule, ModuleTitle);
                }

                return Request.CreateResponse(HttpStatusCode.OK, "");
            }
            catch (Exception exc)
            {
                Logger.Error(exc);
                return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc);
            }
        }
        private void SaveData()
        {
            OpenContentController ctrl = new OpenContentController();
            var data = ctrl.GetFirstContent(ModuleId);

            if (string.IsNullOrEmpty(txtSource.Text))
            {
                if (data != null)
                {
                    ctrl.DeleteContent(data);
                }
            }
            else
            {
                JObject json = JObject.Parse(txtSource.Text);
                if (data == null)
                {
                    data = new OpenContentInfo()
                    {
                        ModuleId = ModuleId,
                        Title = json["Title"] == null ? ModuleContext.Configuration.ModuleTitle : json["Title"].ToString(),
                        CreatedByUserId = UserInfo.UserID,
                        CreatedOnDate = DateTime.Now,
                        LastModifiedByUserId = UserInfo.UserID,
                        LastModifiedOnDate = DateTime.Now,
                        Html = "",
                        Json = txtSource.Text
                    };
                    ctrl.AddContent(data);
                }
                else
                {
                    data.Title = json["Title"] == null ? ModuleContext.Configuration.ModuleTitle : json["Title"].ToString();
                    data.LastModifiedByUserId = UserInfo.UserID;
                    data.LastModifiedOnDate = DateTime.Now;
                    data.Json = txtSource.Text;
                    ctrl.UpdateContent(data);
                }

                if (json["ModuleTitle"] != null && json["ModuleTitle"].Type == JTokenType.String)
                {
                    string ModuleTitle = json["ModuleTitle"].ToString();
                    OpenContentUtils.UpdateModuleTitle(ModuleContext.Configuration, ModuleTitle);
                }
            }
        }