@Override
  public void capitalize(Deposit deposit) throws DepositCapitalizationIllegalStateException {

    System.out.println(
        "capitalization of #"
            .concat(deposit.getId().toString())
            .concat(" next capitalization ")
            .concat(deposit.getNextCapitalization().toString()));

    BigDecimal saldo = billingSystemUtils.getDepositSaldo(deposit.getId());

    if (saldo.compareTo(BigDecimal.ZERO) < 1) {
      System.out.println("Нет денег - нет прибыли");
      throw new DepositCapitalizationIllegalStateException(
          "На счету нет денег. Капитализация невозможна");
    }

    if (deposit.getPercent() == null || deposit.getPercent().compareTo(BigDecimal.ZERO) < 1) {
      throw new DepositCapitalizationIllegalStateException(
          "Не задана процентная ставка. Каитализация невозможна");
    }

    DepositCalculation depositCalculationMonth =
        new DepositCalculation(saldo, 1, deposit.getDepositorFormType());
    depositCalculationMonth.percents = deposit.getPercent();

    BigDecimal sumToAdd =
        depositCalculationService.calculateSumInTheEnd(depositCalculationMonth).add(saldo.negate());

    billingSystemUtils.doDepositPayInMonthlyProfit(
        deposit.getId(), sumToAdd, deposit.getNextCapitalization());

    Calendar calendar = Calendar.getInstance();
    calendar.setTime(deposit.getNextCapitalization());
    calendar.add(Calendar.MONTH, 1);

    deposit.setNextCapitalization(calendar.getTime());

    entityManager.merge(deposit);
  }
  @Override
  public void dropCapitalizationDate(Deposit deposit) {
    deposit.setNextCapitalization(null);

    entityManager.merge(deposit);
  }