private static function getUploadedFileLeaves(array $uploaded_files)
    {
        $new_file = [];

        if (isset($uploaded_files['tmp_name']) && !is_array($uploaded_files['tmp_name'])) {
            $new_file = new UploadedFile(
                $uploaded_files['name'] ?? null,
                $uploaded_files['type'] ?? null,
                $uploaded_files['tmp_name'] ?? null,
                $uploaded_files['error'] ?? null,
                $uploaded_files['size'] ?? null,
                true
            );
        } elseif (isset($uploaded_files['tmp_name'][0])) {
            foreach ($uploaded_files['tmp_name'] as $key => $value) {
                $new_file[$key] = new UploadedFile(
                    $uploaded_files['name'][$key] ?? null,
                    $uploaded_files['name'][$key] ?? null,
                    $uploaded_files['tmp_name'][$key] ?? null,
                    $uploaded_files['error'][$key] ?? null,
                    $uploaded_files['size'][$key] ?? null,
                    true
                );
            }
        } else {
            foreach (array_keys($uploaded_files['tmp_name']) as $index) {
                $new_array = array_combine(
                    array_keys($uploaded_files),
                    array_column($uploaded_files, $index)
                );

                $new_file[$index] = static::getUploadedFileLeaves($new_array);
            }
        }

        return $new_file;
    }