private Criteria[] prepareUserUpdate(Criteria criteria, AbstractDao dao) throws DaoException {
        Criteria[] crit = new Criteria[]{new Criteria(), new Criteria()};
        crit[0].addParam(DAO_ID_USER, criteria.getParam(DAO_ID_USER));
        crit[0].addParam(DAO_USER_SELECT_FOR_UPDATE, true);
        List<User> users = dao.findUsers(crit[0]);
        if (users.isEmpty()) {
            throw new DaoException("User not found.");
        }
        User user = users.get(0);
        Float userBalance = user.getBalance();
        Float finalPrice = (Float) criteria.getParam(DAO_ORDER_FINAL_PRICE);
        if (userBalance < finalPrice) {
            throw new DaoLogicException("message.userBalance");
        }
        crit[1].addParam(DAO_USER_BALANCE, userBalance - finalPrice);
        Integer discountForOrder = PriceDiscountManager.getDiscountForOrder(user.getDiscount(), finalPrice);
        crit[1].addParam(DAO_USER_DISCOUNT, discountForOrder);
        return crit;
    }