public void apply() throws XPathExpressionException {

        Element existing = editor.getXMLElementByString("/MLP_Save/PlayerData/Storage/StoredItem[@ID='" + id + "']");

        // add the pony, if necessary
        if(this.add.isSelected()) {

            if(existing != null) {
                // System.out.println("Pony " + id + " already in inventory");
            } else {
                Element inventory = editor.getXMLElementByString("/MLP_Save/PlayerData/Storage");
                Element pony = inventory.getOwnerDocument().createElement("StoredItem");
                MessageUtil.debug("Adding pony " + id + " to inventory.");
                pony.setAttribute("ID", id);
                inventory.appendChild(pony);
            }
        }
        // remove pony, if necessary
        else {

            if(existing == null) {
                // System.out.println("Pony " + id + " not in inventory anyway");
            } else {
                MessageUtil.debug("Removing pony " + id + " from inventory.");
                existing.getParentNode().removeChild(existing);
                
            }
        }

    }