public static async Task UploadVersion(this IPlanGridApi api, string projectUid, string versionName, params VirtualFile[] files) { VersionUpload versionUpload = await api.UploadVersion(projectUid, new UploadVersionRequest { NumberOfFiles = files.Length, VersionName = versionName }); var tasks = new List <Task>(); foreach (var item in versionUpload.FileUploadRequests.Zip(files, (x, y) => new { File = y, Request = x })) { tasks.Add(api.RequestFileUpload(item.Request, item.File)); } await Task.WhenAll(tasks); await api.CompleteVersionUpload(projectUid, versionUpload.Uid); }