public async Task AdminRegisterOrUpdate(IAdminConfig config) { User?existingAdmin = await userRepo.FindByUsername(config.Username); if (existingAdmin != null) { // Check if we need to update the password to match the config one. if (!existingAdmin.Authenticate(config.Password)) { existingAdmin.ResetPassword(config.Password); await userRepo.Update(existingAdmin); } } else { User user = factory.CreateFromAdminConfig(config); await userRepo.Add(user); } }