public async Task UploadAsync(string url, IDictionary<string, string> headers, string method, byte[] data)
 {
     using (var client = new CustomWebClient())
     {
         SubscribeToUploadEvents(client);
         if (headers != null)
         {
             foreach (var header in headers)
                 client.Headers[header.Key] = header.Value;
         }
                         
         await client.UploadDataTaskAsync(url, "PUT", data);
         UnsubscribeFromUploadEvents(client);
     }
 }
        public async Task UploadAsync(string url, IDictionary <string, string> headers, string method, byte[] data)
        {
            using (var client = new CustomWebClient())
            {
                SubscribeToUploadEvents(client);
                if (headers != null)
                {
                    foreach (var header in headers)
                    {
                        client.Headers[header.Key] = header.Value;
                    }
                }

                await client.UploadDataTaskAsync(url, "PUT", data);

                UnsubscribeFromUploadEvents(client);
            }
        }