public void GetAsFile(string filename, FileMode fileMode, FileAccess fileAccess)
        {
            var response = GetResponse();

            try
            {
                using (var fileStream = new FileStream(filename, fileMode, fileAccess))
                {
                    using (Stream responseStream = response.GetResponseStream())
                    {
                        var stream = WebClientService.GetTimeoutStream(responseStream, Timeout);

                        CopyStream(stream, fileStream);
                    }
                }
            }
            catch (AsyncTimeoutException e)
            {
                throw new WebClientException("Master timeout exception", e);
            }
            catch (Exception e)
            {
                throw new WebClientException("Unable to read response from server", e);
            }
        }
        public byte[] GetAsByteArray()
        {
            var response = GetResponse();

            try
            {
                using (var fileStream = new MemoryStream())
                {
                    using (Stream responseStream = response.GetResponseStream())
                    {
                        var stream = WebClientService.GetTimeoutStream(responseStream, Timeout);

                        CopyStream(stream, fileStream);
                    }
                    return(fileStream.ToArray());
                }
            }
            catch (AsyncTimeoutException e)
            {
                throw new WebClientException("Master timeout exception", e);
            }
            catch (Exception e)
            {
                throw new WebClientException("Unable to read response from server", e);
            }
        }