private function getFilesToProcess(Request $request, $namespace, $files = null)
    {
        $this->app['upload.namespace'] = $namespace;

        if ($files === null) {
            $files = $request->files->get($namespace);
        }

        if (!$files) {
            return [];
        }
        $filesToProcess = [];
        foreach ($files as $file) {
            if ($file instanceof UploadedFile) {
                $filesToProcess[] = [
                    'name'     => $file->getClientOriginalName(),
                    'tmp_name' => $file->getPathname(),
                ];
            } else {
                $filesToProcess[] = $file;
            }
        }

        return $filesToProcess;
    }