private function getExtension(UploadedFile $file): ?string
    {
        $originalName = $file->getClientOriginalName();

        if ($extension = pathinfo($originalName, PATHINFO_EXTENSION)) {
            return strtolower($extension);
        }

        if ($extension = $file->guessExtension()) {
            return strtolower($extension);
        }

        return null;
    }