/**
  * Returns all attribute's values as array
  *
  * @param AttributeInterface $attribute
  *
  * @return array
  */
 protected function getAttributeValuesSet(AttributeInterface $attribute)
 {
     $attributeValuesCollection = $this->attributeValueRepository->getCollectionByAttribute($attribute);
     $values = [];
     $attributeValuesCollection->map(function (AttributeValueInterface $attributeValue) use(&$values) {
         $values[] = ['id' => $attributeValue->getId(), 'name' => $attributeValue->translate()->getName()];
     });
     return $values;
 }
 /**
  * Prepares collection from passed attribute values
  *
  * @param array $values
  *
  * @return ArrayCollection
  */
 protected function makeAttributeValuesCollection($values)
 {
     $collection = new ArrayCollection();
     foreach ($values as $id) {
         $item = $this->attributeValueRepository->find($id);
         if (null !== $item) {
             $collection->add($item);
         }
     }
     return $collection;
 }