public function setRole(UserInterface $user, array $selectedRole)
    {
        $choices = $this->rolesManager->getChoices();

        if (!isset($choices[$selectedRole['roles']])) {
            throw new InvalidArgumentException(
                sprintf('Impossible to set role %s', $selectedRole['roles'])
            );
        }

        $user->setRoles([$choices[$selectedRole['roles']]]);

        $this->entityManager->flush();
    }