public function deleteAll()
    {
        $response = [
            'success' => true,
            'deleted' => []
        ];
        if (!$this->isXmlHttpRequest()) {
            throw new common_exception_BadRequest('wrong request mode');
        }

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

        $ids = [];

        foreach ($this->getRequestParameter('ids') as $id) {
            $ids[] = $id['id'];
        }

        $this->signatureValidator->checkSignatures($this->getRequestParameter('ids'));

        $this->validateInstancesRoot($ids);

        foreach ($ids as $id) {
            $deleted = false;
            try {
                if ($this->hasWriteAccess($id)) {
                    $resource = new \core_kernel_classes_Resource($id);
                    if ($resource->isClass()) {
                        $deleted = $this->getClassService()->deleteClass(new \core_kernel_classes_Class($id));
                    } else {
                        $deleted = $this->getClassService()->deleteResource($resource);
                    }
                }
            } catch (\common_Exception $ce) {
                \common_Logger::w('Unable to remove resource ' . $id . ' : ' . $ce->getMessage());
            }
            if ($deleted) {
                $response['deleted'][] = $id;
            }
        }

        return $this->returnJson($response);
    }