private int theNumberOfMaterialIsAvailableForThisDay(Loan loan,
            GregorianCalendar calendar) {

        int quantity = this.getStock().getQuantity(loan.getName());

        for (Loan l : this.getStock().getLoans()) {

            if (l.getName().equals(loan.getName())) {

                if (0 >= l.getStart().compareTo(calendar)
                        && l.getEnd().compareTo(calendar) >= 0) {

                    quantity -= l.getQuantity();
                }
            }
        }

        return quantity;
    }