/**
  * Delete an existing account (soft delete)
  *
  * @param array $input
  * 	An array as follows: array(id => $id);
  *
  * @return JSON encoded string
  *  A string as follows:
  *	In case of success: {"success" : form.defaultSuccessDeleteMessage}
  */
 public function delete(array $input)
 {
     $info = false;
     $this->DB->transaction(function () use($input, &$info) {
         $loggedUserId = $this->AuthenticationManager->getLoggedUserId();
         $organizationId = $this->AuthenticationManager->getCurrentUserOrganization('id');
         $ids = $this->getAccountChildrenIds($input['id']);
         array_push($ids, $input['id']);
         if ($this->JournalEntry->byAccountIds($ids)->count() > 0) {
             $info = $this->Lang->get('decima-accounting::account-management.accountValidationMessage');
             return;
         }
         $this->Account->byIds($ids)->each(function ($Account) use($loggedUserId, $organizationId) {
             $Journal = $this->Journal->create(array('journalized_id' => $Account->id, 'journalized_type' => $this->Account->getTable(), 'user_id' => $loggedUserId, 'organization_id' => $organizationId));
             $this->Journal->attachDetail($Journal->id, array('note' => $this->Lang->get('decima-accounting::account-management.accountDeletedAccount', array('account' => $Account->key . ' ' . $Account->name)), $Journal));
         });
         $this->Account->delete($ids);
     });
     if (!$info) {
         return json_encode(array('success' => $this->Lang->get('form.defaultSuccessDeleteMessage')));
     } else {
         return json_encode(array('info' => $info));
     }
 }