public void CreateAndMigrateDatabase( DemoDbContext demoDbContext, ITrainingSessionRepository trainingSessionRepository) { var demoDbExists = demoDbContext.Exists(); if (!demoDbExists || (!demoDbContext.AllMigrationsApplied())) { demoDbContext.Database.Migrate(); if (!demoDbExists) { InitializeDatabaseAsync(trainingSessionRepository).Wait(); } } }