public bool TryGetGeoLocation(PayPalVariables source, out GeoLocation location)
 {
     location = null;
     return false;
 }
        public bool TryGetGeoLocation(PayPalVariables source, out GeoLocation location)
        {
            location = new GeoLocation();
            try
            {
                var geoCountry = GetCountry(source.address_country, source.address_country_code);
                var geoCity = GetCity(source.address_city, source.address_state, source.address_zip, source.address_country, source.address_country_code);
                var geoState = GetState(geoCity.State, source.address_country, source.address_country_code);

                City city;
                State state;
                Country country;
                var isCity = _metadataRepository.TryGetCity(geoCity.Name, geoState.Name, geoCity.PostalCode, geoCountry.FullName, out city);
                var isState = _metadataRepository.TryGetState(geoState.Name, geoCountry.FullName, out state);   
                var isCountry = _metadataRepository.TryGetCountry(geoCountry.FullName, out country);                                          

                if (!isCountry)
                {                    
                    country = _metadataRepository.CreateCountry(geoCountry);
                }
                if (!isState)
                {                    
                    geoState.CountryId = country.CountryId;
                    state = _metadataRepository.CreateState(geoState);
                }
                if (!isCity)
                {
                    geoCity.StateId = state.StateId;
                    geoCity.PostalCode = geoCity.PostalCode;
                    city = _metadataRepository.CreateCity(geoCity);
                }
                var address = GetAddress(source.address_street, city.Name, state.FullName, city.PostalCode, country.FullName, country.Name);
                if (address != null)
                {
                    address.CityId = city.CityId;
                    address.StateId = state.StateId;
                    address.CountryId = country.CountryId;
                    location.Address = address;
                }                
                location.City = city;
                location.State = state;
                location.Country = country;
                location.IsGeocoded = true;
                return true;
            }
            catch (Exception ex)
            {
                Log.Error("Error while Geocoding.", ex);
            }
            return false;
        }