/**
  * Extract tags in an Article
  * @param LifecycleEventArgs $args
  */
 public function postPersist(LifecycleEventArgs $args)
 {
     $entity = $args->getEntity();
     $em = $args->getEntityManager();
     if (!$entity instanceof Article) {
         return;
     }
     $length = $this->setLimitFrequency($entity->getContent());
     $tags = $this->extractTags($entity->getContent());
     // Add Tags to an Article
     foreach ($tags as $key => $value) {
         // Check the frequency of the a given tag
         if ($value >= $length) {
             $tag = new Tag();
             $tag->setSlug($key);
             $tag->setFrequency($value);
             $tag->addArticle($entity);
             $entity->addTag($tag);
             $em->persist($tag);
             $em->persist($entity);
         }
     }
     $em->flush();
 }