/**
  * Returns attribute by id
  *
  * @param int $attributeId
  *
  * @return \WellCommerce\Bundle\AttributeBundle\Entity\AttributeInterface
  */
 protected function findAttribute($attributeId)
 {
     $id = $this->getRequestHelper()->getRequestBagParam('attribute');
     $attribute = $this->attributeRepository->find($id);
     if (null === $attribute) {
         throw new AttributeNotFoundException($attributeId);
     }
     return $attribute;
 }
 /**
  * Creates an attribute or returns the existing one
  *
  * @param int                     $id
  * @param string                  $name
  * @param AttributeGroupInterface $group
  *
  * @return AttributeInterface
  */
 public function getAttribute($id, $name, AttributeGroupInterface $group)
 {
     $attribute = $this->repository->find($id);
     if (null === $attribute) {
         $attribute = $this->createNewAttribute($name, $group);
     }
     return $attribute;
 }