protected static function _append($changes, $key, $value, $change) {
		$options = ['finalize' => false];

		if (!is_object($value) || !method_exists($value, 'export')) {
			$changes[$change][$key] = ($change === 'update') ? $value : true;
			return $changes;
		}
		if (!$value->exists()) {
			$changes[$change][$key] = static::_create($value->export(), $options);
			return $changes;
		}
		if ($change === 'update') {
			$export = compact('key') + $value->export();
			return Set::merge($changes, static::_update($export));
		}
		if ($children = static::_update($value->export())) {
			return Set::merge($changes, $children);
		}
		$changes[$change][$key] = true;
		return $changes;
	}
protected static function _append($changes, $key, $value, $change) {
		$options = ['finalize' => false];

		if (!is_object($value) || !method_exists($value, 'export')) {
			$changes[$change][$key] = ($change === 'update') ? $value : true;
			return $changes;
		}
		if (!$value->exists()) {
			$changes[$change][$key] = static::_create($value->export(), $options);
			return $changes;
		}
		if ($change === 'update') {
			$export = compact('key') + $value->export();
			return Set::merge($changes, static::_update($export));
		}
		if ($children = static::_update($value->export())) {
			return Set::merge($changes, $children);
		}
		$changes[$change][$key] = true;
		return $changes;
	}
protected static function _append ( $ changes , $ key , $ value , $ change ) { $ options = [ 'finalize' => false ] ; if ( ! is_object ( $ value ) || ! method_exists ( $ value , 'export' ) ) { $ changes [ $ change ] [ $ key ] = ( $ change === 'update' ) ? $ value : true ; return $ changes ; } if ( ! $ value -> exists ( ) ) { $ changes [ $ change ] [ $ key ] = static :: _create ( $ value -> export ( ) , $ options ) ; return $ changes ; } if ( $ change === 'update' ) { $ export = compact ( 'key' ) + $ value -> export ( ) ; return Set :: merge ( $ changes , static :: _update ( $ export ) ) ; } if ( $ children = static :: _update ( $ value -> export ( ) ) ) { return Set :: merge ( $ changes , $ children ) ; } $ changes [ $ change ] [ $ key ] = true ; return $ changes ; }
Handles appending nested objects to document changesets.

@param array $changes The full set of changes to be made to the database.
@param string $key The key of the field to append, which may be a dot-separated path if the
value is or is contained within a nested object.
@param mixed $value The value to append to the changeset. Can be a scalar value, array, a
nested object, or part of a nested object.
@param string $change The type of change, as to whether update/remove or rename etc.
@return array Returns the value of `$changes`, with any new changed values appended.
Handles appending nested objects to document changesets .