public EventVenueMapping SaveToVenue(ChauffeurRoute routeDetail, Event @event, SaveLocationReturnValues locationValues) { try { var venue = _venueRepository.GetByVenueNameAndCityId(routeDetail.LocationHeader, locationValues.cityId); if (venue == null || venue.Name == null) { venue = _venueRepository.Save(new Venue { AltId = Guid.NewGuid(), Name = routeDetail.LocationHeader, AddressLineOne = routeDetail.PickupLocation, AddressLineTwo = routeDetail.PickupLocation, CityId = locationValues.cityId, Latitude = locationValues.lat.ToString(), Longitude = locationValues.lng.ToString(), ModifiedBy = @event.ModifiedBy, IsEnabled = true }); } var eventVenueMapping = _eventVenueMappingRepository.GetByEventIdAndVenueId(@event.Id, venue.Id); if (eventVenueMapping == null) { eventVenueMapping = _eventVenueMappingRepository.Save(new EventVenueMapping { EventId = @event.Id, VenueId = venue.Id, IsEnabled = true, CreatedUtc = DateTime.UtcNow, UpdatedUtc = null, CreatedBy = @event.ModifiedBy, UpdatedBy = null, ModifiedBy = @event.ModifiedBy }); } return(eventVenueMapping); } catch (Exception ex) { _logger.Log(LogCategory.Error, ex); return(new EventVenueMapping()); } }