public IActionResult Create([FromBody] Location location, [FromRoute] int planId) { var userPlans = _planRepository.GetPlans(_currentUser.Id).Where(p => p.Id == planId); if (userPlans.Count() == 0) { return(NotFound($"There is no plan with specified ID: {planId}")); } _locationsRepository.CreateLocation(location, planId); return(Created(string.Empty, location)); }