protected function processData(ImportResult $importResult, $dataRowsToSkip, $maxDataRows, $collectData = false)
    {
        if ($collectData !== false) {
            $dataCollected = [
                'attributeKeys' => [],
                'attributeControllers' => [],
                'data' => [],
            ];
        } else {
            $dataCollected = null;
        }
        if ($this->csvSchema === null) {
            $importResult->getErrors()->add(t('The CSV schema has not been read.'));
        } else {
            if ($dataCollected !== null) {
                $attributeKeysAndControllers = $this->getAttributeKeysAndControllers();
                foreach ($attributeKeysAndControllers as $attributeIndex => list($attributeKey, $attributeController)) {
                    $dataCollected['attributeKeys'][$attributeIndex] = $attributeKey;
                    $dataCollected['attributeControllers'][$attributeIndex] = $attributeController;
                }
            }
            if ($maxDataRows !== null) {
                $maxDataRows = (int) $maxDataRows;
            }
            if ($maxDataRows === null || $maxDataRows > 0) {
                $dataRowsToSkip = (int) $dataRowsToSkip;
                $this->reader->setOffset(1 + ($dataRowsToSkip > 0 ? $dataRowsToSkip : 0));
                $this->reader->each(function ($cells, $rowIndex) use ($importResult, $maxDataRows, &$dataCollected, $collectData) {
                    $importResult->countRowProcessed($rowIndex);
                    $staticValues = $this->csvSchema->getStaticValues($cells);
                    try {
                        $object = $this->getObjectWithStaticValues($staticValues);
                    } catch (UserMessageException $x) {
                        $importResult->addLineProblem(true, $x->getMessage());
                        $object = null;
                    }
                    if ($object !== null) {
                        $attributesValues = $this->csvSchema->getAttributesValues($cells);
                        $attributesValueObjects = $this->assignCsvAttributes($object, $attributesValues, $importResult);
                        $importResult->increaseImportSuccessCount();
                        if ($dataCollected !== null) {
                            if ($collectData === true || count($dataCollected['data']) < $collectData) {
                                $dataCollected['data'][] = [
                                    'object' => $object,
                                    'attributeValues' => $attributesValueObjects,
                                ];
                            }
                        }
                    }

                    return $maxDataRows === null || $importResult->getTotalDataRowsProcessed() < $maxDataRows;
                });
            }
        }
        if ($dataCollected !== null) {
            $importResult->setDataCollected($dataCollected);
        }
    }