public async Task <bool> DeleteCategoryAsync(int categoryID) { if (categoryID == 0) { return(false); } using (var uow = UnitOfWorkProvider.Create()) { if (await categoryService.GetAsync(categoryID) == null) { return(false); } var itemCategories = (await itemCategoryService.GetItemCategoriesByCategoryIdAsync(categoryID)); foreach (var itemCategory in itemCategories) { itemCategoryService.Delete(itemCategory.Id); } categoryService.Delete(categoryID); await uow.Commit(); return(true); } }