/// <summary>
        /// Inits Event Store
        /// </summary>
        public Exercise08Snapshots()
        {
            databaseConnection = PostgresDbConnectionProvider.GetFreshDbConnection();

            var databaseProvider =
                new PostgresqlDatabaseProvider(databaseConnection)
            {
                SchemaName = typeof(Exercise08Snapshots).Name
            };

            var migrationsAssembly = typeof(Exercise08Snapshots).Assembly;
            var migrator           = new SimpleMigrator(migrationsAssembly, databaseProvider);

            migrator.Load();
            migrator.MigrateToLatest();

            // Create Event Store
            eventStore = new EventStore(databaseConnection);

            var userSnapshot = new SnapshotToTable <User>(
                databaseConnection,
                @"TODO write upsert here");

            eventStore.AddSnapshot(userSnapshot);

            // Initialize Event Store
            eventStore.Init();

            repository = new Repository <User>(eventStore);
        }
        /// <summary>
        /// Inits Event Store
        /// </summary>
        public Exercise08Snapshots()
        {
            databaseConnection = PostgresDbConnectionProvider.GetFreshDbConnection();

            var databaseProvider =
                new PostgresqlDatabaseProvider(databaseConnection)
            {
                SchemaName = typeof(Exercise08Snapshots).Name
            };

            var migrationsAssembly = typeof(Exercise08Snapshots).Assembly;
            var migrator           = new SimpleMigrator(migrationsAssembly, databaseProvider);

            migrator.Load();
            migrator.MigrateToLatest();

            // Create Event Store
            eventStore = new EventStore(databaseConnection);

            var userSnapshot = new SnapshotToTable <User>(
                databaseConnection,
                @"INSERT INTO users (id, name, version) VALUES (@Id, @Name, @Version)
                 ON CONFLICT (id)
                 DO UPDATE SET name = @Name, version = @Version");

            eventStore.AddSnapshot(userSnapshot);

            // Initialize Event Store
            eventStore.Init();

            repository = new Repository <User>(eventStore);
        }