public async Task <Restaurant> CreateRestaurantAsync(long cityId, CreateRestaurantRq createRestaurant) { var city = await _cityRepository.GetByIdAsync(cityId); if (city == null) { throw new ApplicationNotFoundException($"Could not found {nameof(City)} with id '{cityId}'"); } var restaurant = _mapper.Map <Restaurant>(createRestaurant); var newRestaurant = await _restaurantRepository.AddAsync(restaurant); var junction = new CityRestaurantJunction { CityId = city.Id.Value, RestaurantId = newRestaurant.Id.Value }; var newRestaurants = await _restaurantRepository.AddCityRestaurantJunction(junction); return(newRestaurant); }