public function getLastInitialTransactionAttempt() {
    $lastAttempt = null;

    if (isset($this->transactions) && is_array($this->transactions) && count($this->transactions) > 0) {
      // Return the entry with the highest timestamp with type sale, authorize,
      // or submission
      foreach ($this->transactions as $transaction) {
        if (in_array($transaction->getOperation(), array("sale", "authorize", "submission")) && $transaction->getRefTransactionID() == null) {
          if ($lastAttempt == null || $lastAttempt->getDate() < $transaction->getDate()) {
            $lastAttempt = $transaction;
          }
        }
      }
    }

    return $lastAttempt;
  }