public override void HandleExecute(ChainRequest request)
        {
            //1. Step Setup
            myRequest             = (ButlerProcessRequest)request;
            _MediaServicesContext = new CloudMediaContext(myRequest.MediaAccountName, myRequest.MediaAccountKey);
            myEncodigSupport      = new EncoderSupport(_MediaServicesContext);
            myBlobManager         = BlobManagerFactory.CreateBlobManager(myRequest.ProcessConfigConn);
            IjsonKeyValue dotControlData = myBlobManager.GetDotControlData(myRequest.ButlerRequest.ControlFileUri);
            IjsonKeyValue processData    = new jsonKeyValue(myBlobManager.GetButlerConfigurationValue(ProcessConfigKeys.DefualtPartitionKey, myRequest.ProcessTypeId + ".config"));

            IjsonKeyValue allPorcessData = myBlobManager.GetProcessConfig(myRequest.ButlerRequest.ControlFileUri, myRequest.ProcessTypeId);

            //2. Get Current Asset
            IAsset asset = (from m in _MediaServicesContext.Assets select m).Where(m => m.Id == myRequest.AssetId).FirstOrDefault();

            //3. JOB parameters
            string OutputAssetsName   = asset.Name + "_mbGridEncode";
            string JobName            = string.Format("GridEncodeStep_{1}_{0}", myRequest.ProcessInstanceId, asset.Name);
            string MediaProcessorName = myEncodigSupport.GetMediaProcessorName(allPorcessData, DotControlConfigKeys.GridEncodeStepMediaProcessorName, "Media Encoder Standard");

            string[] encodeConfigurations = myEncodigSupport.GetLoadEncodignProfiles(dotControlData, processData, DotControlConfigKeys.GridEncodeStepEncodeConfigList, myRequest.ButlerRequest.MezzanineFiles, myRequest.ProcessConfigConn, this.StepConfiguration);

            //4. Execute JOB and Wait
            IJob currentJob = myEncodigSupport.ExecuteGridJob(OutputAssetsName, JobName, MediaProcessorName, encodeConfigurations, "Grid Task", asset.Id, MyEncodigSupport_OnJobError, MyEncodigSupport_JobUpdate);

            //9. Update AssetID
            myRequest.AssetId = currentJob.OutputMediaAssets.FirstOrDefault().Id;
        }
        private void buildlocator()
        {
            myAsset = _MediaServiceContext.Assets.Where(xx => xx.Id == myRequest.AssetId).FirstOrDefault();
            var daysForWhichStreamingUrlIsActive = 365;

            var accessPolicy = _MediaServiceContext.AccessPolicies.Create(
                myAsset.Name
                , TimeSpan.FromDays(daysForWhichStreamingUrlIsActive)
                , AccessPermissions.Read);

            var locator = _MediaServiceContext.Locators.CreateLocator(LocatorType.Sas, myAsset, accessPolicy, DateTime.UtcNow.AddMinutes(-5));

            //Add to metadata Locator path
            if (!myRequest.MetaData.ContainsKey("sasPathurl"))
            {
                myRequest.MetaData.Add("sasPathurl", locator.Path);
            }
            //Add all files URL to log?
            string jsonProcessConfiguration = StorageManager.GetButlerConfigurationValue(
                ProcessConfigKeys.DefualtPartitionKey,
                myRequest.ProcessTypeId + ".config");
            var processConfiguration = new Common.ResourceAccess.jsonKeyValue(jsonProcessConfiguration);

            if (processConfiguration.Read(ProcessConfigKeys.CreateSasLocatorStepLogAllAssetFile).ToLower() == "yes")
            {
                List <string> urlList = new List <string>();
                foreach (var file in myAsset.AssetFiles)
                {
                    urlList.Add(locator.BaseUri + "/" + file.Name + locator.ContentAccessComponent);
                }
                string jsonList = Newtonsoft.Json.JsonConvert.SerializeObject(urlList);
                if (myRequest.MetaData.ContainsKey("sasFileUrlList"))
                {
                    myRequest.MetaData["sasFileUrlList"] = jsonList;
                }
                else
                {
                    myRequest.MetaData.Add("sasFileUrlList", jsonList);
                }
            }
        }