/// <summary>
        /// Load or create process request from snapshot table
        /// </summary>
        /// <param name="currentRequest">current reequest</param>
        /// <param name="currentSteps">Steps list</param>
        /// <returns></returns>
        private ProcessRequest restoreRequestOrCreateMetadata(ProcessRequest currentRequest, List <StepHandler> currentSteps)
        {
            Common.ResourceAccess.IButlerStorageManager storageManager = Common.ResourceAccess.BlobManagerFactory.CreateBlobManager(currentRequest.ProcessConfigConn);
            var processSnap = storageManager.readProcessSanpShot(currentRequest.ProcessTypeId, currentRequest.ProcessInstanceId);

            if (processSnap == null)
            {
                //First time Execution
                string workflowStepListData = Newtonsoft.Json.JsonConvert.SerializeObject(currentSteps);
                currentRequest.MetaData.Add(Configuration.MBFConfiguration.workflowStepListKey, workflowStepListData);
                currentRequest.MetaData.Add(Configuration.MBFConfiguration.workflowStepLength, currentSteps.Count.ToString());
            }
            else
            {
                //Second or other time execution
                //load Metadata
                dynamic dynObj = Newtonsoft.Json.JsonConvert.DeserializeObject((processSnap).jsonContext);
                //Dictionary<string, string> dynMetaData = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>((dynObj.MetaData.ToString()));
                currentRequest.MetaData = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, string> >((dynObj.MetaData.ToString()));
                //load Errors
                currentRequest.Exceptions = Newtonsoft.Json.JsonConvert.DeserializeObject <List <string> >((dynObj.Exceptions.ToString()));
                //Load LOGS Log
                currentRequest.Log = Newtonsoft.Json.JsonConvert.DeserializeObject <List <string> >((dynObj.Log.ToString()));
            }
            return(currentRequest);
        }
        /// <summary>
        /// Execute process
        /// </summary>
        /// <param name="currentMessage">information message</param>
        private void execute(CloudQueueMessage currentMessage)
        {
            ProcessRequest myRequest = null;
            string         txt;

            Common.ResourceAccess.IButlerStorageManager storageManager = null;

            try
            {
                lock (myLock)
                {
                    currentProcessRunning += 1;
                }
                ButlerRequest watcherRequest = Newtonsoft.Json.JsonConvert.DeserializeObject <ButlerRequest>(currentMessage.AsString);
                //Load Workflow's steps
                List <StepHandler> mysteps = BuildChain(watcherRequest.WorkflowName);

                myRequest = GetCurrentContext(watcherRequest.WorkflowName);

                myRequest.CurrentMessage = currentMessage;
                myRequest.ProcessTypeId  = watcherRequest.WorkflowName;
                //ProcessInstanceId:
                //Single File: MessageID Guid (random)
                //multiFile package: Container folder guid ID (set for client)
                myRequest.ProcessInstanceId = this.getProcessId(watcherRequest.ControlFileUri, watcherRequest.MessageId.ToString());

                myRequest.ProcessConfigConn = this.myProcessConfigConn;
                myRequest.IsResumeable      = (this.ReadConfigOrDefault(myRequest.ProcessTypeId + ".IsResumeable") == "1");

                //Restore Status
                storageManager = Common.ResourceAccess.BlobManagerFactory.CreateBlobManager(myRequest.ProcessConfigConn);
                myRequest      = restoreRequestOrCreateMetadata(myRequest, mysteps);

                //2.Execute Chain
                txt = string.Format("[{0}] Starting new Process, type {1} and ID {2}", this.GetType().FullName, myRequest.ProcessTypeId, myRequest.ProcessInstanceId);
                Trace.TraceInformation(txt);
                mysteps.FirstOrDefault().HandleRequest(myRequest);
                //FinishProcess();
                txt = string.Format("[{0}] Finish Process, type {1} and ID {2}", this.GetType().FullName, myRequest.ProcessTypeId, myRequest.ProcessInstanceId);
                Trace.TraceInformation(txt);
                //Finish Status
                myRequest.CurrentStepIndex = Configuration.MBFConfiguration.successFinishProcessStep;
                storageManager.PersistProcessStatus(myRequest);

                lock (myLock)
                {
                    currentProcessRunning -= 1;
                }
            }
            catch (Exception xxx)
            {
                if (myRequest != null)
                {
                    //foreach (Exception item in myRequest.Exceptions)
                    foreach (string errorTxt in myRequest.Exceptions)
                    {
                        //Full Rollback?
                        txt = string.Format("[{0}] Error list process {1} intance {2} error: {3}", this.GetType().FullName, myRequest.ProcessTypeId, myRequest.ProcessInstanceId, errorTxt);
                        Trace.TraceError(txt);
                    }
                    txt = string.Format("[{0}] Error list process {1} intance {2} error: {3}", this.GetType().FullName, myRequest.ProcessTypeId, myRequest.ProcessInstanceId, xxx.Message);
                    myRequest.Exceptions.Add(txt);

                    //Update Status
                    myRequest.CurrentStepIndex = Configuration.MBFConfiguration.failFinishProcessStep;
                    storageManager.PersistProcessStatus(myRequest);
                }
                else
                {
                    txt = string.Format("[{0}] Error {1} without context Request yet", this.GetType().FullName, xxx.Message);
                    Trace.TraceError(xxx.Message);
                }
                //Exception no Managed

                lock (myLock)
                {
                    currentProcessRunning -= 1;
                }
            }
            //3.return control
            if (myRequest != null)
            {
                myRequest.DisposeRequest();
            }
            else
            {
                Trace.TraceError("myRequest is null raw message " + currentMessage.AsString);
            }
            myRequest = null;

            Trace.Flush();
        }