public static function getOrCreate(GeocodeCached $locationInfo, Theatre $theatre, $computeDistance = false)
 {
     $where = $locationInfo->getQueryWhere()->where('theatre_id', $theatre->id);
     $manager = static::manager();
     $nearby = $manager->getEntityWhere($where);
     if ($nearby) {
         return $nearby;
     }
     $data = $locationInfo->toArray(0, 2, array('country_iso', 'postal_code', 'country', 'city'));
     $data['distance_m'] = $computeDistance ? LocationService::instance()->computeDistance($locationInfo->getGeocode(), $theatre->getGeocode()) : -1;
     $data['theatre_id'] = $theatre->id;
     $nearbyId = $manager->createEntity($data)->save();
     return $nearbyId ? $manager->getEntity($nearbyId) : null;
 }
 public function dataLoaded(GeocodeCached $locationInfo, $date = null)
 {
     $queryWhere = $locationInfo->getQueryWhere();
     if ($date) {
         $queryWhere->where('load_date', $date);
     }
     return GeocodeLoaded::manager()->getEntityWhere($queryWhere) !== null;
 }