private function importData(string $data): int
    {
        $errorCount = 0;

        foreach ($this->importer->importData($data) as $index => $result) {
            if ($result instanceof SuccessResult) {
                $this->io->note(
                    sprintf(
                        'Imported %1$s #%2$d into %1$s ID %3$d',
                        $result->getEntityType(),
                        $index + 1,
                        $result->getEntityId()
                    )
                );

                continue;
            }

            if ($result instanceof ErrorResult) {
                $this->io->error(sprintf('Could not import %s #%d', $result->getEntityType(), $index + 1));
                $this->io->section('Error stack:');
                $this->renderThrowableStack($result->getError());
                $this->io->newLine();

                ++$errorCount;

                continue;
            }
        }

        return $errorCount;
    }