public function save($objectID, $categoryConstant, array $attributes, $entryID = null) {
        $params = [
            'object' => $objectID,
            'data' => $attributes,
            'category' => $categoryConstant
        ];

        if (isset($entryID)) {
            $params['entry'] = $entryID;
        }

        $result = $this->api->request(
            'cmdb.category.save',
            $params
        );

        if (!array_key_exists('entry', $result) ||
            !is_int($result['entry']) ||
            !array_key_exists('success', $result) ||
            $result['success'] !== true) {
            if (array_key_exists('message', $result)) {
                throw new RuntimeException(sprintf('Bad result: %s', $result['message']));
            } else {
                throw new RuntimeException('Bad result');
            }
        }

        return $result['entry'];
    }