     @return {object}    A object observe state.
     ###
     @unobserve: ->
-      Object.unobserve @records, @observer
-
+      Object.unobserve @records, observer for observer in @observers
+      @callbacks = []
+      @observers = []
 
     # -- INSTANCE ----------------------------------------------------------------
     ###

    @param  {function}  A function to execute each time the fields change.
    @return {object}    Hamsa instance.
    ###
    constructor: (attributes = {}, handler, events = DEFAULT_EVENTS) ->
      @constructor.className = @constructor.name
      @constructor.records[@uid = _guid()] = @
      for field, define of @constructor.fields when attributes[field] or define.default?
        if typeof @[field] is 'function'
          @[field] attributes[field] or define.default
        else
          @[field] = _cast attributes[field], define
      @observe handler, events if handler?
      @

    ###

    @param  {function}  A function to execute each time the fields change.
    @return {object}    A object observe state.
    ###
    observe: (callback, events = DEFAULT_EVENTS) ->
      observer = Object.observe @, (states) =>
        for state in states when state.name in @constructor.names
          delete state.object.observer
          callback state
      , events
      @callbacks.push callback
      @observers.push observer
      observer

    ###
    Unobserve changes in a determinate Hamsa instance.
    @method unobserve
    @return {object}    A object observe state.
    ###
    unobserve: ->
      Object.unobserve @, observer for observer in @observers
      @callbacks = []
      @observers = []

    ###
    Destroy current Hamsa instance
    @method destroy
    @return {object}    Current Hamsa instance
    ###
    destroy: (trigger = true) ->
      if trigger
        for callback in @callbacks
          callback
            type    : "destroy"
            name    : @uid
            oldValue: @fields()
      delete @constructor.records[@uid]

    fields: ->
      value = {}
      value[name] = @[name] for name in @constructor.names
      value

  if typeof define is "function" and define.amd
    define -> Hamsa
