public function findMediaWithFilenameInCollectionWithId($filename, $collectionId)
    {
        $queryBuilder = $this->createQueryBuilder('media')
            ->innerJoin('media.files', 'files')
            ->innerJoin('files.fileVersions', 'versions', 'WITH', 'versions.version = files.version')
            ->join('media.collection', 'collection')
            ->where('collection.id = :collectionId')
            ->andWhere('versions.name = :filename')
            ->orderBy('versions.created')
            ->setMaxResults(1)
            ->setParameter('filename', $filename)
            ->setParameter('collectionId', $collectionId);
        $result = $queryBuilder->getQuery()->getResult();

        if (count($result) > 0) {
            return $result[0];
        }

        return;
    }