     createRecord: (store, type, record) -> new Promise (resolve) ->
         key = guid()
         value = serialize record, store.serializerFor type.typeKey
-        
+
         localStorage.setItem key, value
         resolve()
 

serialize = (record, serializer) ->
    object = serializer.serialize record
    json = JSON.stringify object
    utf8_to_b64 json

guid = (->
    s4 = ->

    defaultSerializer: '-rest'

    find: (store, type, id) -> new Promise (resolve, reject) ->
        try
            result = { }
            result[type.typeKey] = deserialize id, localStorage.getItem id
            resolve result

        catch error
