public static AdditionalDataInfo Get(string xmldata)
            {
                AdditionalDataInfo adi = new AdditionalDataInfo();

                adi.Notify = false;
                adi.AssetBitmapReference = string.Empty;

                if (!StringUtils.IsBlank(xmldata))
                {
                    try
                    {
                        var doc = new XmlDocument();
                        doc.LoadXml(xmldata);

                        adi.Notify = (doc.SelectSingleNode("//Notify") != null && Boolean.Parse(doc.SelectSingleNode("//Notify").InnerText));
                        adi.AssetBitmapReference = (doc.SelectSingleNode("//AssetBitmapReference") != null) ? doc.SelectSingleNode("//AssetBitmapReference").InnerText : string.Empty;
                    }
                    catch (Exception ex)
                    {
                        m_Logger.WarnFormat("Unable to get additional data: {0}", ex.Message);
                    }
                }

                return(adi);
            }
        public override void ProcessRequest()
        {
            m_Logger.Debug("ProcessingCallbackHandler called");

            if (Context.Request.QueryString["testcallback"] == "1")
            {
                Context.Response.Write("Test: " + DateTime.Now.ToString("dd MMMM yyyy HH:mm:ss") + ", " + Guid.NewGuid().ToString().ToLower());
                return;
            }

#if DEBUG
            foreach (string key in Context.Request.Form.Keys)
            {
                string val = Context.Request.Form[key];

                if (val.Length > 150)
                {
                    val = val.Substring(0, 150) + "...";
                }

                m_Logger.DebugFormat("  - {0} - {1}", key, val);
            }
#endif

            AssetId        = WebUtils.GetIntRequestParam("AssetId", 0);
            PreviewPath    = WebUtils.GetRequestParam("PreviewPath", string.Empty);
            ThumbnailPath  = WebUtils.GetRequestParam("ThumbnailPath", string.Empty);
            MetadataXml    = WebUtils.GetRequestParam("MetadataXml", string.Empty);
            AdditionalData = AdditionalDataInfo.Get(WebUtils.GetRequestParam("AdditionalData", string.Empty));

            if (AssetId == 0)
            {
                Context.Response.Write("ERROR - Missing asset id");
                return;
            }

            Asset = Asset.Get(AssetId);

            if (Asset.IsNull)
            {
                Context.Response.Write("ERROR - Invalid asset id");
                return;
            }

            m_Logger.DebugFormat("Asset ID: {0}", AssetId);

            ProcessFiles();
        }
        /// <summary>
        /// Adds Related data (a.k.a Additional Data).
        /// Related data is data that is supportive to the Core data of datasource. Eg Categories, Enums, etc
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="scope">The scope.</param>
        /// <param name="key">The key.</param>
        /// <param name="data">The data.</param>
        public virtual void AddData(DataSourceContext context, string scope, string key, JToken data)
        {
            string scopeStorage           = AdditionalDataUtils.GetScope(scope, context.PortalId, context.TabId, GetModuleId(context), context.TabModuleId);
            AdditionalDataController ctrl = new AdditionalDataController();
            var additionalData            = new AdditionalDataInfo()
            {
                Scope                = scopeStorage,
                DataKey              = key,
                Json                 = data.ToString(),
                CreatedByUserId      = context.UserId,
                CreatedOnDate        = DateTime.Now,
                LastModifiedByUserId = context.UserId,
                LastModifiedOnDate   = DateTime.Now,
            };

            ctrl.AddData(additionalData);
        }