public function clear($objectID, array $categoryConsts) {
        $batch = $this->batchRead([$objectID], $categoryConsts);

        $requests = [];
        $counter = 0;
        $index = 0;

        foreach ($batch as $entries) {
            $categoryConst = $categoryConsts[$index];

            foreach ($entries as $entry) {
                $requests[] = [
                    'method' => 'cmdb.category.archive',
                    'params' => [
                        'object' => $objectID,
                        'category' => $categoryConst,
                        'entry' => (int) $entry['id']
                    ]
                ];

                $counter++;
            }

            $index++;
        }

        if ($counter === 0) {
            return 0;
        }

        $results = $this->api->batchRequest($requests);

        foreach ($results as $result) {
            if (!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 $counter;
    }