code: function (widgets) {
  
            if (!this.storage) {
              return true;
            }
  
            var serialized = _.map(widgets, function (widget) {
              var widgetObject = {
                title: widget.title,
                name: widget.name,
                style: widget.style,
                dataModelOptions: widget.dataModelOptions,
                storageHash: widget.storageHash,
                attrs: widget.attrs
              };
  
              return widgetObject;
            });
  
            var item = { widgets: serialized, hash: this.hash };
  
            if (this.stringify) {
              item = JSON.stringify(item);
            }
  
            this.storage.setItem(this.id, item);
            return true;
          }
docs: Takes array of widget instance objects, serializes,
  and saves state.
  
  @param  {Array} widgets  scope.widgets from dashboard directive
  @return {Boolean}        true on success, false on failure