code: function dateLastPaymentWasReceived(loan) {
      var d = Q.defer();
      var result = null;
      if (!loan || !loan.transactions) {
        d.reject('required dateLastPaymentWasReceived not provided');
      } else {
        loan.transactions.forEach(function (tx) {
          result = tx.receivedDate;
        });
        if (result) {
          loan.dateLastPaymentWasReceived = result;
          d.resolve(loan);
        } else d.reject('no transactions to determine dateLastPaymentWasReceived');
      }
      return d.promise;
    }
docs: dateLastPaymentWasReceived
  @param loan
  - transactions