/**
  * Persists an attribute
  * @return int|object
  */
 public function save()
 {
     $repo = new AttributeRepository();
     return $repo->insertAttribute($this);
 }
        /**
         * insert attribute
         * @return Object
         */
        public function procShopToolInsertAttribute()
        {
            $repository = new AttributeRepository();

            $args = Context::getRequestVars();
            $args->is_filter  = (int)(bool)$args->is_filter;
            if ($args->is_filter) {
                if (!in_array($args->type, array(AttributeRepository::TYPE_SELECT, AttributeRepository::TYPE_SELECT_MULTIPLE, AttributeRepository::TYPE_NUMERIC))) {
                    $args->is_filter = 0;
                }
            }
            $args->module_srl = $this->module_info->module_srl;
            $logged_info = Context::get('logged_info');
            $args->member_srl = $logged_info->member_srl;

            $attribute = new Attribute($args);
            $attribute->module_srl = $this->module_srl;
            try
            {
                if ($attribute->attribute_srl) {
                    $repository->updateAttribute($attribute);
                    $this->setMessage("success_updated");
                }
                else {
                    $output = $repository->insertAttribute($attribute);
                    $this->setMessage("success_registed");
                }
            }
            catch (Exception $e) {
                return new Object(-1, $e->getMessage());
            }

            $returnUrl = getNotEncodedUrl('', 'act', 'dispShopToolManageAttributes');
            $this->setRedirectUrl($returnUrl);
        }