protected function determineKeywordsState($key, array $newKeywords = [], array $oldKeywords = [])
    {
        $this->setKeywordsOperation(true);

        static $state = [];

        // Build state if:
        // - not built yet
        // - $newKeywords or $oldKeywords is provided
        if (! isset($state[$key]) || func_num_args() > 1) {
            $old = empty($oldKeywords) ? parent::get($this->generateInverseIndexKey($key), []) : $oldKeywords;
            $new = $this->mergeKeywords ? array_unique(array_merge($old, $newKeywords)) : $newKeywords;
            $state[$key] = [
                'old'      => $old,
                'new'      => $new,
                'obsolete' => array_diff($old, $new),
            ];
        }

        $this->setKeywordsOperation(false);

        return $state[$key];
    }