void AuditSaga(Saga saga, IncomingContext context)
        {
            string messageId;

            if (!context.IncomingLogicalMessage.Headers.TryGetValue(Headers.MessageId, out messageId))
            {
                return;
            }

            var activeSagaInstance = context.Get <ActiveSagaInstance>();
            var sagaStateString    = Serializer.Serialize(saga.Entity);
            var messageType        = context.IncomingLogicalMessage.MessageType.FullName;
            var headers            = context.IncomingLogicalMessage.Headers;

            sagaAudit.Initiator   = BuildSagaChangeInitatorMessage(headers, messageId, messageType);
            sagaAudit.IsNew       = activeSagaInstance.IsNew;
            sagaAudit.IsCompleted = saga.Completed;
            sagaAudit.Endpoint    = configure.Settings.EndpointName();
            sagaAudit.SagaId      = saga.Entity.Id;
            sagaAudit.SagaType    = saga.GetType().FullName;
            sagaAudit.SagaState   = sagaStateString;

            AssignSagaStateChangeCausedByMessage(context);
            backend.Send(sagaAudit);
        }
        void ReportToBackend(CheckResult result)
        {
            var sender = Builder.Build <ISendMessages>();

            var serviceControlBackend = new ServiceControlBackend(sender, Configure, CriticalError);

            serviceControlBackend.Send(new ReportCustomCheckResult
            {
                HostId        = UnicastBus.HostInformation.HostId,
                Host          = UnicastBus.HostInformation.DisplayName,
                EndpointName  = Configure.Settings.EndpointName(),
                CustomCheckId = Id,
                Category      = Category,
                HasFailed     = result.HasFailed,
                FailureReason = result.FailureReason,
                ReportedAt    = DateTime.UtcNow
            });
        }
        void ReportToBackend(CheckResult result)
        {
            var sender = Builder.Build<ISendMessages>();

            var serviceControlBackend = new ServiceControlBackend(sender, Configure, CriticalError);
            serviceControlBackend.Send(new ReportCustomCheckResult
            {
                HostId = UnicastBus.HostInformation.HostId,
                Host = UnicastBus.HostInformation.DisplayName,
                EndpointName = Configure.Settings.EndpointName(),
                CustomCheckId = Id,
                Category = Category,
                HasFailed = result.HasFailed,
                FailureReason = result.FailureReason,
                ReportedAt = DateTime.UtcNow
            });
        }