public async Task SaveEventAsync <TEvent>(TEvent @event) where TEvent : IEvent
        {
            const string sql = @"INSERT INTO [dbo].[Events] 
                                ([EventId], [EventPayload], [EventTimestamp]) 
                                VALUES 
                                (@eventId, @eventPayload, @eventTimestamp)";

            using (var connection = new SqlConnection(this.connectionString))
            {
                await connection.ExecuteAsync(sql, new
                {
                    eventId        = @event.Id,
                    eventPayload   = serializer.SerializeObject(@event),
                    eventTimestamp = @event.Timestamp
                });
            }
        }
        private Message BuildBrokeredMessage(IDomainEvent domainEvent)
        {
            var json    = _serializer.SerializeObject(domainEvent);
            var message = new Message(_encoder.Encode(json))
            {
                ContentType = domainEvent.GetType().Name
            };

            var userProperties = _userPropertyStrategies
                                 .SelectMany(s => s.GetUserProperties(domainEvent))
                                 .ToList();

            userProperties.ForEach(kvp => message.UserProperties.TryAdd(kvp));
            message.UserProperties.Add("Encoding", _encoder.Name);

            return(message);
        }