public function regenerateUsernamePasswordTokenWithRoles(array $roles, $mergeWithExistingRoles = true)
    {
        $user = $this->token->getUser();
        $credentials = $this->token->getCredentials();
        $providerKey = $this->token->getProviderKey();

        if ($mergeWithExistingRoles) {
            $roles = array_merge($roles, $this->token->getRoles());
        }

        $this->token = new UsernamePasswordToken($user, $credentials, $providerKey, $roles);
    }