protected function execute(InputInterface $input, OutputInterface $output)
 {
     $helper = $this->getHelper('question');
     try {
         $this->getContainer()->get('cloud.ldap.userprovider');
     } catch (\Exception $e) {
         $output->writeln("<error>Can't connect to database</error>");
         return 255;
     }
     // check options
     $action = null;
     try {
         $action = $this->getAction($input->getOptions());
     } catch (\InvalidArgumentException $e) {
         $output->writeln('<error>' + $e->getMessage() + '</error>');
     }
     // read username
     if ($input->getArgument('username') !== null) {
         $username = $input->getArgument('username');
     } else {
         $question = new Question('Please enter the name of the User:'******'cloud.ldap.userprovider')->getUsernames());
         $username = $helper->ask($input, $output, $question);
     }
     // check username for existence
     try {
         $this->user = $this->getContainer()->get('cloud.ldap.userprovider')->loadUserByUsername($username);
     } catch (UserNotFoundException $e) {
         $output->writeln('User not found');
         return 1;
     }
     // check for service attribute
     $service = null;
     if ($input->getOptions()['service'] !== null) {
         $serviceName = $input->getOption('service');
         if ($serviceName == '.') {
             $question = new Question('Please enter the name of the Service:');
             $question->setAutocompleterValues($this->getContainer()->get('cloud.ldap.userprovider')->getServiceNames());
             $serviceName = $helper->ask($input, $output, $question);
         }
         $service = $this->user->getService($serviceName);
         if ($service == null) {
             $output->writeln('<error>can\'t find service</error>');
             return 1;
         }
     }
     if ($action == null) {
         $passwords = null;
         if ($service != null) {
             $passwords = $service->getPasswords();
         } else {
             $passwords = $this->user->getPasswords();
         }
         foreach ($passwords as $password) {
             $output->writeln($password->getId());
         }
         return 0;
         // complete listed alls passwords
     }
     // read id
     if ($input->getArgument('id')) {
         $this->passwordId = $input->getArgument('id');
     } else {
         $question = new Question('Please enter password id:');
         if ($service != null) {
             $passwords = $service->getPasswords();
         } else {
             $passwords = $this->user->getPasswords();
         }
         $question->setAutocompleterValues(array_keys($passwords));
         $this->passwordId = $helper->ask($input, $output, $question);
     }
     if ($action == "delete") {
         if (!$input->getOption('force')) {
             $question = new ConfirmationQuestion('You realy whant to delete this password? [y/N]:', false);
             if (!$helper->ask($input, $output, $question)) {
                 $output->writeln('<error>canceled by user, if you use a script use \'-f\' to force delete</error>');
                 return 1;
             }
         }
         if ($service != null) {
             $password = $service->getPassword($this->passwordId);
             if ($password == null) {
                 $output->writeln('<error>can\'t find password with this id</error>');
                 return 1;
             }
             $service->removePassword($password);
         } else {
             $password = $this->user->getPassword($this->passwordId);
             if ($password == null) {
                 $output->writeln('<error>can\'t find password with this id</error>');
                 return 1;
             }
             $this->user->removePassword($password);
         }
         $this->getContainer()->get('cloud.ldap.util.usermanipulator')->update($this->user);
         return 0;
         // complete delete a password
     }
     // read password
     if ($input->getArgument('password')) {
         $this->password = $input->getArgument('password');
     } else {
         $question = new Question('Please enter password:'******'cloud.ldap.util.usermanipulator')->update($this->user);
         return 0;
     }
     if ($action == "modify") {
         if ($service != null) {
             $password = $service->getPassword($this->passwordId);
         } else {
             $password = $this->user->getPassword($this->passwordId);
         }
         $password->setPasswordPlain($this->password);
         $this->getContainer()->get('cloud.ldap')->updateUser($this->user);
         return 0;
     }
 }