public async Task <Category> AddCategoryTrAsync(Category Category) { var CategoryEntity = mapper.Map <CategoryEntity>(Category); CategoriesTrRepository.CreateCategoryTr(CategoryEntity); if (await CategoriesTrRepository.SaveChangesAsync()) { return(mapper.Map <Category>(CategoryEntity)); } throw new Exception("There were an error with the DB"); }