public function copyUploadedFile(FileModelInterface $model, UploadedFile $uploadedFile, ConnectionInterface $con = null)
    {
        $newUploadedFile = null;

        if ($uploadedFile !== null) {
            $directory = $model->getUploadDir();

            $fileName = $this->renameFile($model->getId(), $uploadedFile);

            $newUploadedFile = $uploadedFile->move($directory, $fileName);
            $model->setFile($fileName);

            if (!$model->save($con)) {
                throw new ImageException(
                    sprintf(
                        'Failed to update model after copy of uploaded file %s to %s',
                        $uploadedFile,
                        $model->getFile()
                    )
                );
            }
        }

        return $newUploadedFile;
    }