public static void Initialize(IApplicationBuilder app, SantaDbContext ctx,
                                      RoleManager <IdentityRole> roleManager,
                                      UserManager <IdentityUser> userManager)
        {
            using (var serviceScope = app.ApplicationServices.GetService <IServiceScopeFactory>().CreateScope())
            {
                var context = serviceScope.ServiceProvider.GetService <SantaDbContext>();
                context.Database.EnsureCreated();
                //context.Database.Migrate();

                // Look for any ailments
                if (context.Children != null && context.Children.Any())
                {
                    return;   // DB has already been seeded
                }
                var children = GetChildren().ToArray();
                context.Children.AddRange(children);
                GetUsersWithRoles(ctx, roleManager, userManager).Wait();
                context.SaveChanges();
            }
        }
        public static async Task GetUsersWithRoles(SantaDbContext context,
                                                   RoleManager <IdentityRole> roleManager,
                                                   UserManager <IdentityUser> userManager)
        {
            //context.Database.EnsureCreated();

            String adminId1 = "";
            String adminId2 = "";

            string role1 = "Admin";
            string role2 = "Child";

            string password = "******";

            if (await roleManager.FindByNameAsync(role1) == null)
            {
                await roleManager.CreateAsync(new IdentityRole(role1));
            }

            if (await roleManager.FindByNameAsync(role2) == null)
            {
                await roleManager.CreateAsync(new IdentityRole(role2));
            }

            if (await userManager.FindByNameAsync("aa") == null)
            {
                var user = new IdentityUser
                {
                    UserName = "******",
                    Email    = "*****@*****.**"
                };

                var result = await userManager.CreateAsync(user);

                if (result.Succeeded)
                {
                    await userManager.AddPasswordAsync(user, password);

                    await userManager.AddToRoleAsync(user, role1);
                }
                adminId1 = user.Id;
            }

            if (await userManager.FindByNameAsync("bb") == null)
            {
                var user = new IdentityUser
                {
                    UserName = "******",
                    Email    = "*****@*****.**"
                };

                var result = await userManager.CreateAsync(user);

                if (result.Succeeded)
                {
                    await userManager.AddPasswordAsync(user, password);

                    await userManager.AddToRoleAsync(user, role1);
                }
                adminId2 = user.Id;
            }

            if (await userManager.FindByNameAsync("mm") == null)
            {
                var user = new IdentityUser
                {
                    UserName = "******",
                    Email    = "*****@*****.**"
                };

                var result = await userManager.CreateAsync(user);

                if (result.Succeeded)
                {
                    await userManager.AddPasswordAsync(user, password);

                    await userManager.AddToRoleAsync(user, role2);
                }
            }

            if (await userManager.FindByNameAsync("dd") == null)
            {
                var user = new IdentityUser
                {
                    UserName = "******",
                    Email    = "*****@*****.**"
                };

                var result = await userManager.CreateAsync(user);

                if (result.Succeeded)
                {
                    await userManager.AddPasswordAsync(user, password);

                    await userManager.AddToRoleAsync(user, role2);
                }
            }

            if (await userManager.FindByNameAsync("santa") == null)
            {
                var user = new IdentityUser
                {
                    UserName = "******",
                    Email    = "*****@*****.**"
                };

                var result = await userManager.CreateAsync(user);

                if (result.Succeeded)
                {
                    await userManager.AddPasswordAsync(user, password);

                    await userManager.AddToRoleAsync(user, role1);
                }
            }

            if (await userManager.FindByNameAsync("tim") == null)
            {
                var user = new IdentityUser
                {
                    UserName = "******",
                    Email    = "*****@*****.**"
                };

                var result = await userManager.CreateAsync(user);

                if (result.Succeeded)
                {
                    await userManager.AddPasswordAsync(user, password);

                    await userManager.AddToRoleAsync(user, role2);
                }
            }
        }