public function registerAction()
    {
        $userIdentityField = $this->container->getParameter('rch_jwt_user.user_identity_field');
        $userManager = $this->container->get('fos_user.user_manager');
        $userClass = $userManager->getClass();

        $rules = [
            $userIdentityField => [
                'requirements' => ['email' == $userIdentityField ? new Email() : '[^/]+'],
            ],
            'password' => ['requirements' => '[^/]+'],
        ];

        $params = $this->get('rch_jwt_user.credential_fetcher')
            ->create($rules)
            ->all();

        $user = $this->createUser($params, $userManager);

        return $this->renderToken($user, 201);
    }