                 case .found(let model):
                     Log.info("File was already present: Not uploading again.")
                     let upload = model as! Upload
-                    let response = UploadFileResponse()!
-                    response.size = Int64(upload.fileSizeBytes!)
-                    params.completion(response)
+                    success(params: params, upload: upload)
                     return
                     
                 case .noObjectFound:

import SyncServerShared

extension FileController {
    func uploadFile(params:RequestProcessingParameters) {
        guard let uploadRequest = params.request as? UploadFileRequest else {
            Log.error("Did not receive UploadFileRequest")

            
            let options = CloudStorageFileNameOptions(cloudFolderName: uploadRequest.cloudFolderName!, mimeType: uploadRequest.mimeType)
            
            cloudStorage.uploadFile(cloudFileName:cloudFileName, data: uploadRequest.data, options:options) {[unowned self] result in
                switch result {
                case .success(let fileSize):
                    upload.fileSizeBytes = Int64(fileSize)
                    upload.state = .uploaded
                    upload.uploadId = uploadId
                    if params.repos.upload.update(upload: upload) {
                        self.success(params: params, upload: upload)
                    }
                    else {
                        // TODO: *0* Need to remove the file from the cloud server.
