public CategoryDetailDto GetCategoryById(int id) { var category = _newsRepository.GetCategoryById(id); if (category == null) { throw new Exception($"category with id {id} was not found."); } return(category); }