/**
  * Execute the command.
  *
  * @param AttributeRepository $attributes
  * @param AttributeValueRepository $values
  * @return Attribute
  */
 public function handle(AttributeRepository $attributes, AttributeValueRepository $values)
 {
     $attribute = $attributes->findById($this->id)->fill($this->getProperties());
     $attributes->save($attribute);
     if ($this->add_value) {
         $value = AttributeValue::register($attribute->id, $this->add_value);
         $values->save($value);
     }
     return $attribute;
 }
 function it_can_be_registered()
 {
     $value = AttributeValue::register(1, 'Blue');
     \PHPUnit_Framework_Assert::assertEquals(1, $value->attribute_id);
     \PHPUnit_Framework_Assert::assertEquals('Blue', $value->value);
 }