public function extractContentAndSaveToIndex($files)
    {
        $counter = 0;
        if (is_array($files) && count($files)) {
            foreach ($files as $file) {
                if ($this->fileInfo->setFile($file)) {
                    // get file content, check if we have a FAL resource or a simple
                    // string containing the path to the file
                    if ($file instanceof \TYPO3\CMS\Core\Resource\File) {
                        $content = $this->getFileContent($file->getForLocalProcessing(false));
                    } else {
                        $content = $this->getFileContent($file);
                    }

                    if (!($content === false)) {
                        $this->storeToIndex($file, $content);
                        $counter++;
                    }
                }
            }
        }

        return $counter;
    }