public function uploadFiles(Request $request, Model $model, $relativePath = null)
    {
        if (!$relativePath) {
            $relativePath = $this->getDefaultRelativePath();
        }

        $fileBag = $request->files;
        foreach ($fileBag->all() as $paramName => $uploadedFiles) {
            $attributes = $model->getAttributes();
            if (array_key_exists($paramName, $attributes)) {
                $this->handleNonMultipleFileUploads($model, $paramName, $uploadedFiles, $relativePath);
            } else {
                $this->handleMultipleFileUploads($request, $model, $paramName, $uploadedFiles, $relativePath);
            }
        }

        return $request;
    }