/**
  * @param FamilyInterface    $family
  * @param AttributeInterface $attribute
  * @param string             $channelCode
  *
  * @return AttributeRequirementInterface
  */
 protected function createAttributeRequirement(FamilyInterface $family, AttributeInterface $attribute, $channelCode)
 {
     $channel = $this->channelRepository->findOneByIdentifier($channelCode);
     if (null === $channel) {
         throw new \InvalidArgumentException(sprintf('Channel with "%s" code does not exist', $channelCode));
     }
     $requirement = $this->requirementRepo->findOneBy(['attribute' => $attribute->getId(), 'channel' => $channel->getId(), 'family' => $family->getId()]);
     if (null === $requirement) {
         $requirement = $this->attrRequiFactory->createAttributeRequirement($attribute, $channel, true);
     }
     $requirement->setRequired(true);
     return $requirement;
 }