public static function importFromFile(
        string $file,
        OutputInterface $output,
        callable $saveItems
    ): int {
        $itemsBuffer = [];
        $itemsNb = 0;

        if (false !== ($handle = fopen($file, 'r'))) {
            while (false !== ($data = fgetcsv($handle, 0, ','))) {
                $itemAsArray = [
                    'uuid' => [
                        'id' => $data[0],
                        'type' => $data[1],
                    ],
                    'metadata' => json_decode($data[2], true),
                    'indexed_metadata' => json_decode($data[3], true),
                    'searchable_metadata' => json_decode($data[4], true),
                    'exact_matching_metadata' => json_decode($data[5], true),
                    'suggest' => json_decode($data[6], true),
                ];

                if (is_array($data[7])) {
                    $itemAsArray['coordinate'] = $data[7];
                }

                $item = Item::createFromArray($itemAsArray);
                $itemsBuffer[] = $item;
                ++$itemsNb;

                if (count($itemsBuffer) >= 500) {
                    $saveItems($itemsBuffer, false);
                    self::printPartialCountSaved($output, count($itemsBuffer));

                    $itemsBuffer = [];
                }
            }

            $saveItems($itemsBuffer, true);
            self::printPartialCountSaved($output, count($itemsBuffer));
        }

        fclose($handle);

        return $itemsNb;
    }