// pHash is optional, the account will update its internal copy of the hash anyway.
//
bool OTAccount::SaveOutbox(OTLedger &theBox, OTIdentifier * pHash/*=NULL*/)  // If you pass the identifier in, the hash is recorded there
{
    if (!IsSameAccount(theBox))
    {
        const OTString  strAcctID(GetRealAccountID()),              strServerID(GetRealServerID()),
                        strBoxAcctID(theBox.GetRealAccountID()),    strBoxSvrID(theBox.GetRealServerID());
        OTLog::vError("OTAccount::SaveOutbox: ERROR: The ledger passed in, isn't even for this account!\n"
                      "   Acct ID: %s\n  Other ID: %s\n Server ID: %s\n Other ID: %s\n",
                      strAcctID.Get(), strBoxAcctID.Get(), strServerID.Get(), strBoxSvrID.Get());
        return false;
    }

    OTIdentifier theHash; // Use pHash.
    if (NULL == pHash)
        pHash = &theHash;
    // ------------------------------------------
    bool bSuccess = theBox.SaveOutbox(pHash);

    if (bSuccess)
        this->SetOutboxHash(*pHash);

    return bSuccess;
}