       indexRoot = @indexRoot?() ? @indexRoot
       key = "#{indexRoot}/#{instance.id}"
       if data?
-        key += "/"+Tails.Utils.Hash JSON.stringify data
-        json = JSON.stringify
+        key += "/"+Tails.Utils.Hash @toJSON data
+        json = @toJSON
           "instance" : instance
           "data" : data
       else
-        json = JSON.stringify instance
+        json = @toJSON instance
       @storage().setItem key, json
       return key
 

    storage: ( ) ->
        return localStorage

    indexRoot: ( ) ->
      return inflection.transform(@name, ['underscore', 'pluralize'])


    InstanceMethods: @with Tails.Mixins.Debug,
      included : () =>
        @after initialize: () ->
          console.log @toJSON @name
          @after store: () ->
            @log "Stored instances", @constructor.pluck("id")

