public static void Initialize(
            PersistedGrantDbContext persistedGrantDbContext,
            ConfigurationDbContext configurationDbContext,
            WingedKeysContext wingedKeysContext,
            UserManager <ApplicationUser> userMgr,
            Config config)
        {
            persistedGrantDbContext.Database.EnsureCreated();
            configurationDbContext.Database.EnsureCreated();
            wingedKeysContext.Database.EnsureCreated();

            DeleteAllData(
                configurationDbContext,
                wingedKeysContext,
                userMgr);

            AddClients(config, configurationDbContext);
            AddIdentityResources(config, configurationDbContext);
            AddApiResources(config, configurationDbContext);
            AddTestApplicationUsers(userMgr);
        }
        private static void DeleteAllData(
            ConfigurationDbContext configurationDbContext,
            WingedKeysContext wingedKeysContext,
            UserManager <ApplicationUser> userMgr)
        {
            // Delete tables that are modified in Config.cs
            configurationDbContext.Clients.RemoveRange(
                configurationDbContext.Clients.ToList());
            configurationDbContext.IdentityResources.RemoveRange(
                configurationDbContext.IdentityResources.ToList());
            configurationDbContext.ApiResources.RemoveRange(
                configurationDbContext.ApiResources.ToList());

            // Delete Users and AspNetUserClaims
            var applicationUsers = wingedKeysContext.ApplicationUsers.ToList();

            foreach (var user in applicationUsers)
            {
                var claims = userMgr.GetClaimsAsync(user).GetAwaiter().GetResult();
                userMgr.RemoveClaimsAsync(user, claims).GetAwaiter().GetResult();
            }
            wingedKeysContext.ApplicationUsers.RemoveRange(applicationUsers);
        }