public void create(Category category) throws Exception {
    Category categoryDoc = categoryRepo.findByIdOrName(category.getId(), category.getName());

    if (categoryDoc != null) {
      throw new Exception("category exists");
    }

    categoryRepo.save(category);
  }
  public void update(Category category) throws Exception {
    Category categoryDoc = categoryRepo.findByIdOrName(category.getId(), category.getName());

    if (categoryDoc == null) {
      throw new Exception("can't found category");
    }

    category.setId(categoryDoc.getId());
    category.setRecipes(categoryDoc.getRecipes());

    categoryRepo.save(category);
  }