public void payment(User user, String description, Double amount) throws ServiceException {
   Session session = util.getSession();
   Transaction transaction = null;
   try {
     transaction = session.beginTransaction();
     Operation operation = buildOperation(user, description, amount);
     operationDao.save(operation);
     // TODO сделать множественность счетов
     Set<Account> accounts = user.getAccounts();
     Long accountId = 0L;
     Iterator<Account> iterator = accounts.iterator();
     while (iterator.hasNext()) {
       accountId = iterator.next().getId();
     }
     Account account = accountDao.getById(accountId);
     account.setDeposit(account.getDeposit() - amount);
     accountDao.update(account);
     transaction.commit();
     logger.info(TRANSACTION_SUCCEEDED);
   } catch (DaoException e) {
     TransactionUtil.rollback(transaction, e);
     logger.error(TRANSACTION_FAILED, e);
     throw new ServiceException(TRANSACTION_FAILED + e);
   }
 }
 public void updateAccountStatus(Long id, AccountStatusType status) throws ServiceException {
   Session session = util.getSession();
   Transaction transaction = null;
   try {
     transaction = session.beginTransaction();
     Account account = accountDao.getById(id);
     account.setAccountStatus(status);
     accountDao.update(account);
     transaction.commit();
     logger.info(TRANSACTION_SUCCEEDED);
   } catch (DaoException e) {
     TransactionUtil.rollback(transaction, e);
     logger.error(TRANSACTION_FAILED, e);
     throw new ServiceException(TRANSACTION_FAILED + e);
   }
 }