protected static function normalizeUploadedFiles(array $uploadedFiles)
    {
        $files = [];

        foreach ($uploadedFiles as $key => $value) {

            if ($value instanceof UploadedFileInterface) {

                $files[$key] = $value;

            } elseif (is_array($value) && isset($value['tmp_name'])) {

                $files[$key] = static::createUploadedFileFromSpec($value);

            } elseif (is_array($value)) {
                
                $files[$key]  = static::normalizeUploadedFiles($value);

            } else {

                throw new \InvalidArgumentException('Invalid uploaded files value');
            }
        }

        return $files;
    }