private function fetchCollectionFromApi(array $resourceIds, string $type, string $locale = null): array
    {
        $query = (new Query())
            ->where('sys.id[in]', $resourceIds)
        ;

        if ('Asset' === $type || 'Entry' === $type) {
            $query->setLocale($locale);
        }

        switch ($type) {
            case 'Asset':
                return $this->client->getAssets($query)->getItems();
            case 'ContentType':
                return $this->client->getContentTypes($query)->getItems();
            case 'Entry':
                return $this->client->getEntries($query)->getItems();
            case 'Environment':
                return [$this->client->getEnvironment()];
            case 'Space':
                return [$this->client->getSpace()];
            default:
                throw new \InvalidArgumentException(\sprintf(
                    'Trying to resolve link for unknown type "%s".',
                    $type
                ));
        }
    }