   # This method allows changing properties of the graph.
   setProperties: (properties) ->
     @checkTransactionStart()
+    before = clone @properties
     for item, val of properties
       @properties[item] = val
-    @emit 'changeProperties', @properties
+    @emit 'changeProperties', @properties, before
     @checkTransactionEnd()
 
   # ## Exporting a port from subgraph


    @checkTransactionStart()

    node.metadata = {} unless node.metadata

    for item, val of metadata
      node.metadata[item] = val

    @emit 'changeNode', node
    @checkTransactionEnd()

  # ## Connecting nodes

    return unless @outports[publicPort]

    @checkTransactionStart()
    before = clone @outports[publicPort].metadata
    @outports[publicPort].metadata = {} unless @outports[publicPort].metadata
    for item, val of metadata
      @outports[publicPort].metadata[item] = val
    @emit 'changeOutport', @outports[publicPort], before
    @checkTransactionEnd()

  # ## Grouping nodes in a graph
