@Transactional
    public void deleteItemTemplate(String id) {
        List<Recipe> recipes = getAllRecipes();
        for (Recipe recipe : recipes) {
            if (recipe.getResult().getId().equals(id)) {
                deleteRecipe(recipe.getId());
                continue;
            }
            for (ItemTemplate itemTemplate : recipe.getIngredients()) {
                if (itemTemplate.getId().equals(id)) {
                    deleteRecipe(recipe.getId());
                    break;
                }
            }
        }
        List<User> users = userDAO.getAllUsers();
        ItemTemplate itemTemplate = getItemTemplate(id);
        for (User user : users) {
            Map<String, Long> items = user.getItems();
            if (items.containsKey(itemTemplate.getId())) {
                items.remove(itemTemplate.getId());
            }
            user.setItems(items);
            updateUser(user);
        }
        itemTemplateDAO.deleteItemTemplate(id);
    }