public static void Main(string[] args)
        {
            var host = CreateHostBuilder(args).Build();

            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;

                try
                {
                    var dataBase    = services.GetRequiredService <DataContext>();
                    var userManager = services.GetRequiredService <UserManager <IdentityUser> >();
                    var roleManager = services.GetRequiredService <RoleManager <IdentityRole> >();
                    dataBase.Database.Migrate();
                    // this may lead to deadlock if another thread is waiting for this to complete.
                    // It is okay in our case, no problem will occur.
                    Seed.AddInitialUsersAsync(dataBase, userManager, roleManager).Wait();
                }
                catch (System.Exception ex)
                {
                    var logger = services.GetRequiredService <ILogger <Program> >();
                    logger.LogError(ex, "An error occured during migration");
                }
            }

            host.Run();
        }