STDMETHODIMP BandwidthGroup::COMSETTER(MaxBytesPerSec)(LONG64 aMaxBytesPerSec)
{
    if (aMaxBytesPerSec < 0)
        return setError(E_INVALIDARG,
                        tr("Bandwidth group limit cannot be negative"));

    AutoCaller autoCaller(this);
    if (FAILED(autoCaller.rc())) return autoCaller.rc();

    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);

    m->bd.backup();
    m->bd->aMaxBytesPerSec = aMaxBytesPerSec;

    /* inform direct session if any. */
    ComObjPtr<Machine> pMachine = m->pParent->getMachine();
    alock.release();
    pMachine->onBandwidthGroupChange(this);

    return S_OK;
}