protected function mergeIndexes(&$resource, $input)
    {
        $existingNames = [];

        foreach ($resource->indexes as $index) {
            $existingNames[] = $index->getName();
        }
        $mergeIndexes = 0;
        foreach ($input->indexes as $index) {
            $newIndex = Index::fromString($index);
            if (!empty($newIndex->getName()) && in_array($newIndex->getName(), $existingNames)) {
                $this->warn('The index "' . $newIndex->getName() . '" already exists in the file.');
                continue;
            }

            $resource->indexes[] = $newIndex;
            $existingNames[] = $newIndex->getName();
            $mergeIndexes++;
        }

        return $mergeIndexes;
    }