private void GetNewSurveysCallback(IAsyncResult result)
 {
     try
     {
         var request = (WebRequest)result.AsyncState;
         var response = (WebResponse)request.EndGetResponse(result);
         using (var stream = response.GetResponseStream())
         {
             var surveyXmlParser = new SurveysCollectionParser();
             var surveysToDownload = surveyXmlParser.GetSurveysDownloadUrlsFromStream(stream).ToList();
             _surveysToDownloadCount = surveysToDownload.Count;
             _downloadedSurveysList = new List<Survey>();
             if (surveysToDownload.Count != 0)
                 foreach (var downloadUrl in surveysToDownload)
                     DownloadSurvey(downloadUrl, _currentUser.Name,_currentUser.Password);
             else
                 InvokeCallbackWithSurveyListParameter(_downloadedSurveysList);
         }
     }
     catch (WebException)
     {
         InvokeCallbackWithSurveyListParameter(null);
     }
     catch (XmlException)
     {
         InvokeCallbackWithSurveyListParameter(null);
     }
 }
 private void GetNewSurveysCallback(IAsyncResult result)
 {
     try
     {
         var request = (WebRequest)result.AsyncState;
         var response = (WebResponse)request.EndGetResponse(result);
         using (var stream = response.GetResponseStream())
         {
             var surveyXmlParser = new SurveysCollectionParser();
             var surveysToDownload = surveyXmlParser.GetSurveysDownloadUrlsFromStream(stream).ToList();
             _surveysToDownloadCount = surveysToDownload.Count;
             _downloadedSurveysList = new List<Survey>();
             if (surveysToDownload.Count != 0)
                 foreach (var downloadUrl in surveysToDownload)
                     DownloadSurvey(downloadUrl, "admin", "ndg");
             else
                 _callback.Invoke(_downloadedSurveysList);
         }
     }
     catch (WebException)
     {
         throw;
     }
     catch (XmlException)
     {
         throw;
     }
 }