function addAndReturnDisposable(d, store) {
        if (store instanceof Array) {
            store.push(d);
        }
        else if (store) {
            store.add(d);
        }
        return d;
    }
Adds the IDisposable to the store if it's set, and returns it. Useful to
Event function implementation.