public function toggleField(Table $table, $id, $value, $field = 'status')
    {
        $this->checkIsAjax();
        $this->_checkToggleData($id, $value);

        $this->_controller->viewBuilder()
            ->setLayout('ajax')
            ->setTemplate('toggle')
            ->setTemplatePath('Common');

        $entity = $table->get($id);
        $entity->set($field, !(int) $value);

        if ($result = $table->save($entity)) {
            $this->_controller->set('entity', $result);
            $this->_controller->render('toggle');
        } else {
            throw new \RuntimeException(__d('core', 'Failed toggling field {0} to {1}', $field, $entity->get($field)));
        }
    }