function(props) {
            var inst,
                cls = this,
                key = props[cls.keyAttr];

            if (key && _.has(cls.cache, key)) {

                inst = cls.cache[key];
                // Check the updated flag
                inst.merge(props);

            } else {
                inst = new cls(props);

                if (key) {
                    cls.cache[key] = inst;
                }

                inst.on("change:"+cls.keyAttr, function(model, key) {
                    var oldKey = model.previous(cls.keyAttr);
                    if (oldKey && _.has(cls.cache, oldKey)) {
                        delete cls.cache[oldKey];
                    }
                    cls.cache[key] = inst;
                });
            }

            return inst;
        }
function(props) {
            var inst,
                cls = this,
                key = props[cls.keyAttr];

            if (key && _.has(cls.cache, key)) {

                inst = cls.cache[key];
                
                inst.merge(props);

            } else {
                inst = new cls(props);

                if (key) {
                    cls.cache[key] = inst;
                }

                inst.on("change:"+cls.keyAttr, function(model, key) {
                    var oldKey = model.previous(cls.keyAttr);
                    if (oldKey && _.has(cls.cache, oldKey)) {
                        delete cls.cache[oldKey];
                    }
                    cls.cache[key] = inst;
                });
            }

            return inst;
        }
function ( props ) { var inst , cls = this , key = props [ cls . keyAttr ] ; if ( key && _ . has ( cls . cache , key ) ) { inst = cls . cache [ key ] ; // Check the updated flag inst . merge ( props ) ; } else { inst = new cls ( props ) ; if ( key ) { cls . cache [ key ] = inst ; } inst . on ( "change:" + cls . keyAttr , function ( model , key ) { var oldKey = model . previous ( cls . keyAttr ) ; if ( oldKey && _ . has ( cls . cache , oldKey ) ) { delete cls . cache [ oldKey ] ; } cls . cache [ key ] = inst ; } ) ; } return inst ; }
works for activities and activityobjects
works for activities and activityobjects