public function add($type, $key, $settings = null, $pkg = null)
 {
     /**
      * @var $key Key
      */
     $key = parent::add($type, $key, $settings, $pkg);
     $key->setAttributeCategoryEntity($this->getCategoryEntity());
     $this->entityManager->persist($key);
     $this->entityManager->flush();
     return $key;
 }