code: function _objectByAttribute(obj, attr, map, action) {
      var subAttrs = attr.split(".");
      var attrValue = obj;
      for (var i = 0; i < subAttrs.length; i++) {
        attrValue = attrValue[subAttrs[i]];
        if (attrValue === undefined) {
          return;
        }
      }
  
      if ($.isArray(attrValue)) {
        // TODO implement this when we actually need it
      }
      else if ($.isPlainObject(attrValue)) {
        for (var key in attrValue) {
          var val = attrValue[key];
          if (!map[key]) {
            map[key] = {};
          }
          if (action === "DELETED") {
            delete map[key][val];
          }
          else {
            map[key][val] = obj;
          }
        }
      }
      else {
        if (action === "DELETED") {
          delete map[attrValue];
        }
        else {
          map[attrValue] = obj;
        }
      }
    }
docs: Handles attr with dot notation TODO write lots of tests for this helper Note: this lives outside the Data prototype for now so it can be used by the helper in DataService as well