public function createUploadedFile(
        StreamInterface $stream,
        int $size = null,
        int $error = \UPLOAD_ERR_OK,
        string $clientFilename = null,
        string $clientMediaType = null,
        string $filename = ''
    ): UploadedFileInterface {
        if (is_null($size)) {
            $size = $stream->getSize();
        }

        $uploadedFile = new UploadedFile($filename, $clientFilename, $clientMediaType, $size, $error);
        $uploadedFile->setStream($stream);

        return $uploadedFile;
    }