public async Task <long> SaveEventAsync(IntegrationEvent integrationEvent)
        {
            Guard.Requires(integrationEvent, nameof(integrationEvent)).IsNotNull();

            if (repository.GetAll().Any(e => e.EventId == integrationEvent.EventId))
            {
                throw new Exception($"Internal error - event id: {integrationEvent.EventId} exists in event log");
            }

            return(await repository.CreateAsync(
                       new IntegrationEventLog
            {
                State = IntegrationEventState.ReadyToPublish,
                EventId = integrationEvent.EventId,
                EventCreationDate = integrationEvent.EventCreationDate,
                EventType = integrationEvent.GetType().FullName,
                EventBody = JsonConvert.SerializeObject(integrationEvent)
            }
                       ));
        }