public function importResourceFromContent($content, $filename, $collectionName = ResourceManager::DEFAULT_PERSISTENT_COLLECTION_NAME, $forcedPersistenceObjectIdentifier = null)
    {
        if (!is_string($content)) {
            throw new Exception(sprintf('Tried to import content into the resource collection "%s" but the given content was a %s instead of a string.', $collectionName, gettype($content)), 1380878115);
        }
        $this->initialize();

        if (!isset($this->collections[$collectionName])) {
            throw new Exception(sprintf('Tried to import a file into the resource collection "%s" but no such collection exists. Please check your settings and the code which triggered the import.', $collectionName), 1380878131);
        }

        /* @var CollectionInterface $collection */
        $collection = $this->collections[$collectionName];

        try {
            $resource = $collection->importResourceFromContent($content);
            $resource->setFilename($filename);
            if ($forcedPersistenceObjectIdentifier !== null) {
                ObjectAccess::setProperty($resource, 'Persistence_Object_Identifier', $forcedPersistenceObjectIdentifier, true);
            }
        } catch (Exception $exception) {
            throw new Exception(sprintf('Importing content into the resource collection "%s" failed: %s', $collectionName, $exception->getMessage()), 1381156155, $exception);
        }

        $this->resourceRepository->add($resource);
        $this->logger->debug(sprintf('Successfully imported content into the resource collection "%s" (storage: %s, a %s. SHA1: %s)', $collectionName, $collection->getStorage()->getName(), get_class($collection->getStorage()), $resource->getSha1()));

        return $resource;
    }