public function import(
        $collection,
        $importData,
        array $options = []
    )
    {
        $collection = $this->makeCollection($collection);

        $tmpContent = '';
        if (is_array($importData)) {
            foreach ($importData as $document) {
                /** @var $document Document */
                $tmpContent .= $document->toJson() . "\r\n";
            }
            $importData = $tmpContent;
            unset($tmpContent);
            $options['type'] = 'documents';
        }

        $this->createCollectionIfOptions($collection, $options);

        $params = array_merge(
            [self::OPTION_COLLECTION => $collection],
            $options
        );

        if (array_key_exists('type', $options)) {
            switch ($options['type']) {
                case 'documents':
                    $params[self::OPTION_TYPE] = 'documents';
                    break;
                case 'array':
                    $params[self::OPTION_TYPE] = 'array';
                    break;
            }
        }

        $url = UrlHelper::appendParamsUrl(Urls::URL_IMPORT, $params);

        $response = $this->getConnection()->post($url, $importData);

        return $response->getJson();
    }