public function import(Model $model, $relations = [], $batchSize = 750, Callable $callback = null)
    {
        $batch = 0;

        while (true)
        {
            // Increase the batch number
            $batch += 1;

            // Load records from the database
            $records = $model
                ->with($relations)
                ->skip($batchSize * ($batch - 1))
                ->take($batchSize)
                ->get();

            // Break out of the loop if we are out of records
            if (count($records) == 0) break;

            // Call the callback function to provide feedback on the import process
            if ($callback)
            {
                $callback($batch);
            }

            // Transform each record before sending it to Elasticsearch
            $data = [];

            foreach ($records as $record)
            {
                $data[] = [
                    'index' => [
                        '_id' => $record->getEsId()
                    ]
                ];

                $data[] = $record->transform(!empty($relations));
            }

            // Bulk import the data to Elasticsearch
            $this->bulk($data);
        }
    }