public function import()
    {
        DB::beginTransaction();

        try {
            $iteration = 0;

            while (! feof($this->file)) {
                $iteration++;

                $csvLine = str_getcsv(fgets($this->file), ';');
                $columnCount = count($csvLine);

                if ($columnCount === 1 && !$this->importer->validateLine($csvLine)) {
                    continue;
                } elseif ($this->importer->validateLine($csvLine)) {
                    $this->handleLine($csvLine);
                } else {
                    throw new InvalidCsvLineException($iteration);
                }
            }

            $this->lines = $this->importer->getModelInstance()->count();

            $this->removeStale();

            if (!$this->dryRun) {
                DB::commit();
            }

            event(new ImportSuccess($this, $this->importer));
        } catch (\Exception $e) {
            DB::rollBack();

            event(new ImportFailed($this, $this->importer, $e));

            // Re-throw the exception to catch it from outside
            throw $e;
        }
    }