public function insertResource ($resourceName) {
        $request = get_request();
        $resource = Resources::get($resourceName);
        if ($request->has("rawQuery")) {
            $query = unserialize($request->get("rawQuery"));
            $resource->fields($query->getFields());
        }
        return $resource->insert();
    }