public function beginTransaction() {
        // check if a transaction is already active
        if ($this->getConnection()->inTransaction())
            throw new \Exception("Already inside a DB transaction. You need to commit it before beginning a new one.");

        try {
            // No need to check for the connection again
            $this->getConnection(false)->beginTransaction();
        } catch (Exception $_e) {
            throw new \Exception("Error while beginning DB transaction: ".$pe->getMessage());
        }
    }