protected override void SaveWorkflowInstanceState(Activity rootActivity, bool unlock)
        {
            WorkflowStatus workflowStatus = WorkflowPersistenceService.GetWorkflowStatus(rootActivity);

            if (workflowStatus == WorkflowStatus.Terminated)
            {
                string workflowError = WorkflowPersistenceService.GetSuspendOrTerminateInfo(rootActivity);
                //Logger.Log.Error(workflowError);
                return;
            }
            base.SaveWorkflowInstanceState(rootActivity, unlock);
        }
        /// <summary>
        /// Persist the current state of the entire workflow
        /// </summary>
        /// <param name="rootActivity"></param>
        /// <param name="unlock"></param>
        protected override void SaveWorkflowInstanceState(
            Activity rootActivity, bool unlock)
        {
            //get the workflow instance Id
            Guid instanceId = WorkflowEnvironment.WorkflowInstanceId;

            //determine the status of the workflow
            WorkflowStatus status =
                WorkflowPersistenceService.GetWorkflowStatus(rootActivity);

            switch (status)
            {
            case WorkflowStatus.Completed:
            case WorkflowStatus.Terminated:
                //delete the persisted workflow
                DeleteWorkflow(instanceId);
                break;

            default:
                //save the workflow
                Serialize(instanceId, Guid.Empty, rootActivity);
                break;
            }
        }