public static void HandleError(MsmqPoisonMessageException error)
        {
            ProcessorQueue processorQueue = (ProcessorQueue)error.Data["processorQueue"];
            MessageQueue poisonQueue = new System.Messaging.MessageQueue(processorQueue.PoisonQueue);
            MessageQueue errorQueue = new System.Messaging.MessageQueue(processorQueue.ErrorQueue);

            using (TransactionScope txScope = new TransactionScope(TransactionScopeOption.RequiresNew))
            {
                try
                {
                    // Send the message to the poison and error message queues.
                    poisonQueue.Send((IWorkflowMessage)error.Data["message"], MessageQueueTransactionType.Automatic);
                    errorQueue.Send((WorkflowErrorMessage)error.Data["errorMessage"], MessageQueueTransactionType.Automatic);
                    txScope.Complete();
                }
                catch (InvalidOperationException)
                {

                }
                finally
                {
                    poisonQueue.Dispose();
                    errorQueue.Dispose();
                }
            }
        }
        /// <summary>
        /// Add a message containing the error to the error queue and the original message to the poison queue
        /// </summary>
        /// <param name="jobName"></param>
        /// <param name="message"></param>
        internal static void AddFrameworkError(ProcessorJob processorJob, IWorkflowMessage message, WorkflowErrorMessage errorMessage)
        {
            try
            {
                WorkflowConfiguration.LoadFrameworkConfig(processorJob);
                ProcessorQueue processorQueue = GetActiveQueue(processorJob, QueueOperationType.Delivery);
                MsmqPoisonMessageException error = new MsmqPoisonMessageException() { Source = processorJob.JobName };
                error.Data["processorQueue"] = processorQueue;
                error.Data["message"] = message;
                error.Data["errorMessage"] = errorMessage;

                QueueOperationsHandler.HandleError(error);
            }
            catch (Exception)
            {

            }
        }