public async Task <ActionResult <List <KitchenIngredientDto> > > GetIngredientsForKitchenByCategory(long kitchenId, long categoryId) { PantryPlannerUser user; try { user = await _userManager.GetUserFromCookieOrJwtAsync(this.User); List <KitchenIngredient> ingredientsInKitchen = _service.GetKitchenIngredientsByCategory(kitchenId, categoryId, user); return(Ok(KitchenIngredientDto.ToList(ingredientsInKitchen))); } catch (ArgumentNullException e) { return(BadRequest(e.Message)); } catch (KitchenNotFoundException e) { return(NotFound(e.Message)); } catch (CategoryNotFoundException e) { return(NotFound(e.Message)); } catch (PermissionsException e) { return(Unauthorized(e.Message)); } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } }