public Models.ImageExportStatusResponseModel GetImageExportStatus(string key)
        {
            bool      completed        = false;
            ExportKey exportKey        = null;
            string    extension        = string.Empty;
            string    extraData        = string.Empty;
            string    providerUrl      = string.Empty;
            string    fullPhysicalPath = string.Empty;

            Models.ImageExportStatusResponseModel ret = null;

            if (ExportKey.TryParse(key, out exportKey))
            {
                if (DateTime.UtcNow.Subtract(exportKey.Created).TotalSeconds >= 1000)
                {
                    ret = new Models.ImageExportStatusResponseModel()
                    {
                        Key     = exportKey.ToString(),
                        Success = false
                    };
                }
                else
                {
                    extension   = Enum.GetName(typeof(Models.ImageExportFormat), exportKey.Format).ToLowerInvariant();
                    providerUrl = System.Configuration.ConfigurationManager.AppSettings["ExportProviderUrl"];

                    if (!string.IsNullOrEmpty(providerUrl) && Ifly.Utils.WebResource.QueryStatus(string.Format("{0}/status?key={1}",
                                                                                                               providerUrl.TrimEnd('/'), System.Web.HttpContext.Current.Server.UrlEncode(exportKey.ToString())), out extraData) == HttpStatusCode.OK)
                    {
                        completed = true;
                    }
                    else
                    {
                        fullPhysicalPath = System.Web.HttpContext.Current.Server.MapPath(string.Format("~/App_Data/Exports/{0}/{1}.{2}",
                                                                                                       exportKey.PresentationId, exportKey.ToString(), extension));

                        if (File.Exists(fullPhysicalPath))
                        {
                            completed = true;
                        }
                    }

                    if (completed)
                    {
                        ret = new Models.ImageExportStatusResponseModel()
                        {
                            Key     = exportKey.ToString(),
                            Success = true
                        };
                    }
                }
            }

            return(ret);
        }
        public Models.VideoExportStatusResponseModel GetVideoExportStatus(string key, string continuation = null, string task = null)
        {
            bool      completed        = false;
            ExportKey exportKey        = null;
            string    extraData        = string.Empty;
            string    providerUrl      = string.Empty;
            string    fullPhysicalPath = string.Empty;

            Models.VideoExportStatusResponseModel ret = null;

            if (ExportKey.TryParse(key, out exportKey))
            {
                if (DateTime.UtcNow.Subtract(exportKey.Created).TotalSeconds >= 1000 && string.Compare(task ?? string.Empty, "publish", true) != 0)
                {
                    ret = new Models.VideoExportStatusResponseModel()
                    {
                        Key     = exportKey.ToString(),
                        Success = false
                    };
                }
                else
                {
                    providerUrl = System.Configuration.ConfigurationManager.AppSettings["ExportProviderUrl"];

                    if (!string.IsNullOrEmpty(providerUrl) && Ifly.Utils.WebResource.QueryStatus(string.Format("{0}/status?key={1}",
                                                                                                               providerUrl.TrimEnd('/'), System.Web.HttpContext.Current.Server.UrlEncode(exportKey.ToString())), out extraData) == HttpStatusCode.OK)
                    {
                        if (string.IsNullOrEmpty(continuation))
                        {
                            completed = true;
                        }
                        else
                        {
                            Ifly.Utils.WebResource.FireAndForget(string.Format("{0}/continue?key={1}&continuation={2}",
                                                                               providerUrl.TrimEnd('/'), System.Web.HttpContext.Current.Server.UrlEncode(exportKey.ToString()),
                                                                               System.Web.HttpContext.Current.Server.UrlEncode(continuation)));

                            ret = new Models.VideoExportStatusResponseModel()
                            {
                                Task = "publish"
                            };
                        }
                    }
                    else
                    {
                        fullPhysicalPath = System.Web.HttpContext.Current.Server.MapPath(string.Format("~/App_Data/Exports/{0}/{1}.mp4",
                                                                                                       exportKey.PresentationId, exportKey.ToString()));

                        if (File.Exists(fullPhysicalPath))
                        {
                            if (string.IsNullOrEmpty(continuation))
                            {
                                completed = true;
                            }
                            else
                            {
                                Ifly.ServiceAdapter.VideoPublishBroker.CreateVideoPublishTask(fullPhysicalPath, continuation);

                                ret = new Models.VideoExportStatusResponseModel()
                                {
                                    Task = "publish"
                                };
                            }
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty((extraData = Ifly.ServiceAdapter.VideoPublishBroker.GetVideoPublishStatus(fullPhysicalPath))))
                            {
                                completed = true;
                            }
                        }
                    }

                    if (completed)
                    {
                        ret = new Models.VideoExportStatusResponseModel()
                        {
                            Key       = exportKey.ToString(),
                            ExtraData = extraData,
                            Success   = true
                        };
                    }
                }
            }

            return(ret);
        }