private static async Task TakeSnapshot(IEventStoreConnection connection, IAggregateRoot aggregate)
        {
            var snapshot     = aggregate.TakeSnapshot();
            var encodedEvent = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(snapshot));
            var eventData    = new EventData(Guid.NewGuid(), snapshot.GetType().Name, true, encodedEvent, null);

            await connection.AppendToStreamAsync(StreamNameGenerator.GenerateForSnapshot(aggregate), ExpectedVersion.Any, eventData);
        }