protected function execute(InputInterface $input, OutputInterface $output)
 {
     $em = $this->getContainer()->get('doctrine')->getManager();
     /** @var PluginManager $processManager */
     $output->writeln('Updating Datamaps...');
     $json = file_get_contents($input->getArgument('url') . '/datamap/list/json');
     if (!$json) {
         throw new \Exception('Wrong JSON response.');
     }
     $datamaps = json_decode($json, true);
     if (count($datamaps)) {
         foreach ($datamaps as $datamap) {
             $output->write('Updating map "' . $datamap['name'] . '... ');
             $localDatamap = $em->getRepository('VRAppBundle:Datamap')->findOneBy(['name' => $datamap['name']]);
             if (!$localDatamap) {
                 $localDatamap = new Datamap();
                 $localDatamap->setName($datamap['name']);
             }
             $localDatamap->setType($datamap['type']);
             $localDatamap->setMap(base64_decode($datamap['map']));
             $localDatamap->setDescription($datamap['description']);
             $em->persist($localDatamap);
             $em->flush();
             $output->writeln('<info>Done</info>');
         }
     }
     $output->writeln('Finished.');
 }