   attributes: {}
 
   constructor: (attributes = {}) ->
-    @attributes = attributes
-    @id = attributes._id
+    if attributes._id
+      @attributes = @demongoize(attributes)
+      @id = attributes._id
+    else
+      @attributes = attributes
 
   isPersisted: -> @id?
 


  save: ->
    return false unless @isValid()

    attributes = @constructor.mongoize(@attributes)
    if @isPersisted()
      @constructor._collection.update @id, { $set: attributes }
    else
      @id = @constructor._collection.insert attributes

    this

  update: (@attributes) ->

      @constructor._collection.remove @id
      @id = null

  mongoize: (attributes) ->
    taken = {}
    for name, value of attributes
      continue if name.match(/^_/)
      taken[name] = value
    taken

  demongoize: (attributes) ->
    taken = {}
    for name, value of attributes
      continue if name.match(/^_/)
      taken[name] = value
    taken

  @_collection: undefined

