 
   constructor: (name, definition) ->
     @_name              = name
-    @_props             = {}
+    @_definition        = definition
+    @_root              = new @_definition.root
     @_propsChanged      = {}
     @_domainEvents      = []
-    @_trackPropsChanged = true
-    @_definition        = definition
-    @_root              = new @_definition.root
 
     @_observerOpen()
 


    domainEvent = new DomainEvent eventParams
    @_domainEvents.push domainEvent


  _getChanges: ->
    @_observer.deliver()

    changes = {}
    if Object.keys(@_propsChanged).length > 0
      changes = @_propsChanged

    changes


  _getEntityMap: ->



  generateDomainEvent: (eventName, params={}) ->
    @_observer.deliver()

    eventParams =
      name: eventName
      aggregate:
        id: @id
        name: @_name

    if Object.keys(@_propsChanged).length > 0
      eventParams.aggregate.changed = @_propsChanged

    entityMap = @_getEntityMap()
    if Object.keys(entityMap).length > 0
