public ActionResult <Continent> Delete(int id) { log("Delete"); ICountryRepository countRepos = new CountryRepository(); if (!contRepos.ExistsContinent(id)) { return(NotFound()); } if (countRepos.GetAll(id).Count() > 0) { GeoException ex = new GeoException("Continent still contains countries."); return(BadRequest(ex.Message)); } else { try { contRepos.RemoveContinent(id); return(NoContent()); } catch (GeoException ex) { return(BadRequest(ex.Message)); } } }