public function setMedias(Account $account, $medias)
    {
        $mediaIds = array_map(
            function($media) {
                return $media['id'];
            },
            $medias
        );

        $foundMedias = $this->mediaRepository->findById($mediaIds);
        $foundMediaIds = array_map(
            function($mediaEntity) {
                return $mediaEntity->getId();
            },
            $foundMedias
        );

        if ($missingMediaIds = array_diff($mediaIds, $foundMediaIds)) {
            throw new EntityNotFoundException($this->mediaRepository->getClassName(), reset($missingMediaIds));
        }

        $account->getMedias()->clear();
        foreach ($foundMedias as $media) {
            $account->addMedia($media);
        }
    }