def _update_subinstance(self, name, subform):
        """Save bound data for a single subform into the XmlObject model
        instance."""
        old_subinstance = getattr(self.instance, name)
        new_subinstance = subform.update_instance()

        # if our instance previously had no node for the subform AND the
        # updated one has data, then attach the new node.
        if old_subinstance is None and not new_subinstance.is_empty():
            setattr(self.instance, name, new_subinstance)

        # on the other hand, if the instance previously had a node for the
        # subform AND the updated one is empty, then remove the node.
        if old_subinstance is not None and new_subinstance.is_empty():
            delattr(self.instance, name)