protected function _beforeEntityUpdate(AnCommandContext $context)
    {
        //if default has changed
        if ($this->_mixer->getModifiedData()->isDefault) {
            $is_default = $this->_mixer->isDefault === true;
            $query = $this->getScopedQuery($context->entity);
            //if it's true, then reset all existing to false
            if ($is_default) {
                $this->getRepository()->update(array('isDefault' => false), $query);
            } else {
                $query->id($this->id, '<>')->limit(1);
                $this->getRepository()->update(array('isDefault' => true), $query);
            }
        }
    }