Refactoring SQL out to a repository, simplifying the upload model, returning uploads json and file download.