 
   save: ->
     return false unless @isValid()
-
-    attributes = @constructor.mongoize(@attributes)
+    
+    attributes = @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

  # Dont allow direct access to _id and _type.
  @mongoize: (attributes) ->
    for name, value of attributes
      delete attributes[name] if name in ['_id', '_type']
    
    attributes

  # Demongoize is just an alias for mongoize.
  @demongoize: @mongoize

  @_collection: undefined


  attributes: {}

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

  isPersisted: -> @id?

