serialize method for NestedEvent class