private async Task <UploadStatus> handleUpload(FilesResource.CreateMediaUpload request, UploadStatus status) { switch (status) { case UploadStatus.Completed: return(UploadStatus.Completed); case UploadStatus.Failed: return(UploadStatus.Failed); default: status = (await request.ResumeAsync()).Status; return(await handleUpload(request, status)); } }