private void ResposeCallbackBase(IAsyncResult result, GooglePlacesGeocodeNotFoundDelegate notfoundDelegate,
                                         GooglePlacesGeocodeFoundDelegate foundDelegate, GooglePlacesGeocodeFailedDelegate failedDelegate)
        {
            var state         = (List <object>)result.AsyncState;
            var googleRequest = (GoogleGeocodeRequest)state[1];

            if (result.IsCompleted)
            {
                try
                {
                    var request              = (HttpWebRequest)state[0];
                    var response             = (HttpWebResponse)request.EndGetResponse(result);
                    var responseStream       = response.GetResponseStream();
                    var serializer           = new DataContractJsonSerializer(typeof(GoogleGeocodeResponse));
                    var googleSearchResponse = (GoogleGeocodeResponse)serializer.ReadObject(responseStream);
                    if (googleSearchResponse.Status == GoogleMapsSearchStatus.OK)
                    {
                        foundDelegate(googleSearchResponse, googleRequest);
                    }
                    else if (googleSearchResponse.Status == GoogleMapsSearchStatus.ZERO_RESULTS)
                    {
                        notfoundDelegate(googleSearchResponse, googleRequest);
                    }
                }
                catch (Exception e)
                {
                    if (failedDelegate == null)
                    {
                        throw e;
                    }
                    failedDelegate(e.Message, e);
                }
            }
            else
            {
                if (failedDelegate == null)
                {
                    throw new Exception("For some reason request is not completed");
                }
                failedDelegate("For some reason request is not completed", null);
            }
        }
        private void ResposeCallbackBase(IAsyncResult  result, GooglePlacesGeocodeNotFoundDelegate notfoundDelegate,
            GooglePlacesGeocodeFoundDelegate foundDelegate, GooglePlacesGeocodeFailedDelegate failedDelegate)
        {
            var state = (List<object>)result.AsyncState;
            var googleRequest = (GoogleGeocodeRequest)state[1];
            if (result.IsCompleted)
            {
                try
                {
                    var request = (HttpWebRequest)state[0];
                    var response = (HttpWebResponse)request.EndGetResponse(result);
                    var responseStream = response.GetResponseStream();
                    var serializer = new DataContractJsonSerializer(typeof(GoogleGeocodeResponse));
                    var googleSearchResponse = (GoogleGeocodeResponse)serializer.ReadObject(responseStream);
                    if (googleSearchResponse.Status == GoogleMapsSearchStatus.OK)
                    {
                        foundDelegate(googleSearchResponse, googleRequest);
                    }
                    else if (googleSearchResponse.Status == GoogleMapsSearchStatus.ZERO_RESULTS)
                    {
                        notfoundDelegate(googleSearchResponse, googleRequest);
                    }
                }
                catch (Exception e)
                {
                    if (failedDelegate == null) throw e;
                    failedDelegate(e.Message, e);
                }
            }
            else
            {
                if (failedDelegate == null) throw new Exception("For some reason request is not completed");
                failedDelegate("For some reason request is not completed", null);

            }
        }