public function deleteClass()
    {
        if (!$this->isXmlHttpRequest() || !$this->hasRequestParameter('id')) {
            throw new common_exception_BadRequest('wrong request mode');
        }

        $id = $this->getRequestParameter('id');

        // Csrf token validation
        $this->validateCsrf();
        $this->validateInstanceRoot($id);

        $this->signatureValidator->checkSignature(
            $this->getRequestParameter('signature'),
            $id
        );

        $clazz = $this->getClass($id);
        if ($this->getRootClass()->equals($clazz)) {
            $success = false;
            $msg = __('You cannot delete the root node');
        } else {
            $label = $clazz->getLabel();
            $success = $this->getClassService()->deleteClass($clazz);
            $msg = $success ? __('%s has been deleted', $label) : __('Unable to delete %s', $label);
        }
        return $this->returnJson(array(
            'deleted' => $success,
            'msg' => $msg
        ));
    }