public ActionResult <PointOfInterest> PostPointOfInterest(Guid cityId, [FromBody] PointOfInterest pointOfInterest) { if (pointOfInterest == null) { return(BadRequest(ModelState)); } if ((!ModelState.IsValid)) { return(BadRequest(ModelState)); } try { var newPointOfInterest = CityService.AddPointOfInterest(cityId, pointOfInterest); return(CreatedAtRoute(nameof(GetPointOfInterest), new { cityId = cityId, id = newPointOfInterest.Id }, newPointOfInterest)); } catch (CityNotFoundException e) { var message = $"City with the id of {cityId} was not found."; Logger.LogInformation(message, e); return(NotFound(message)); } catch (PointOfInterestPersistanceException e) { Logger.LogCritical(e.Message, e); return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } }