public function putAction(Request $request, $roleId, $key)
    {
        /** @var EntityManagerInterface $entityManager */
        $entityManager = $this->get('doctrine.orm.entity_manager');
        /** @var RoleSettingRepository $repository */
        $repository = $this->get('sulu.repository.role_setting');

        $setting = $repository->findSetting($roleId, $key);
        if (!$setting) {
            $setting = $repository->createNew();
        }

        $setting->setKey($key);
        $setting->setValue($request->get('value', []));
        $setting->setRole($entityManager->getReference(Role::class, $roleId));

        $entityManager->persist($setting);
        $entityManager->flush();

        return $this->handleView($this->view($setting->getValue()));
    }