/**
  * Upload and save word content into article
  *
  * @param Array $files
  * @param String $type
  * @return boolean
  */
 public function convert($files, $type)
 {
     foreach ($files as $file) {
         $fileName = $file["fileName"];
         $path = $file["path"];
         $document = new Document($fileName, $path);
         $this->addDocument($document);
         $this->execute();
     }
     foreach ($files as $file) {
         $fileName = $file["fileName"];
         $document = $this->getDocument($fileName);
         $metadata = $document->getMetadata();
         $author = $metadata->get("Author");
         $title = $metadata->get("dc:title");
         if ($title == "") {
             $this->crawler->addContent($document->getContent());
             $title = $this->crawler->filter('body p:first-child b')->text();
             if ($title == "") {
                 $title = $fileName;
             }
         }
         //Create new Article and add images as Files.
         $article = new Article();
         $authors = new ArrayCollection();
         $authors->add($author);
         //$article->setAuthors($authors);
         $article->setContentType($type);
         $article->setTitle($title);
         $article->setContent($document->getContent());
         $references = new ArrayCollection();
         $dm = $this->doctrineMongodb->getManager();
         foreach ($document->images as $image) {
             $uploadedFile = new UploadedFile("upload/" . $document->getName() . "/" . $image, 'original', 'mime/original', 123, UPLOAD_ERR_OK, true);
             $file = new File();
             $file->setFile($uploadedFile);
             $references->add($file);
         }
         //$article->setReferences($references);
         $dm->persist($article);
         $dm->flush();
     }
     return true;
 }