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