public void ThrowIfNotAccepted()
 {
     if (Outcome.DescriptorCode != Accepted.Code)
     {
         throw AmqpIoTErrorAdapter.GetExceptionFromOutcome(Outcome);
     }
 }
        public void ThrowIfError()
        {
            if (Outcome.DescriptorCode != Accepted.Code)
            {
                if (Outcome.DescriptorCode == Rejected.Code)
                {
                    var rejected = (Rejected)Outcome;

                    // Special treatment for NotFound amqp rejected error code in case of DisposeMessage
                    if (rejected.Error != null && rejected.Error.Condition.Equals(AmqpErrorCode.NotFound))
                    {
                        Error error = new Error
                        {
                            Condition = AmqpIoTErrorAdapter.MessageLockLostError
                        };
                        throw AmqpIoTErrorAdapter.ToIotHubClientContract(error);
                    }
                }

                throw AmqpIoTErrorAdapter.GetExceptionFromOutcome(Outcome);
            }
        }