private void writeModuleMetadata(CuratorFramework client, Module module, String path) throws Exception {
		if (module != null) {
			Map<String, String> mapMetadata = new HashMap<String, String>();
			CollectionUtils.mergePropertiesIntoMap(module.getProperties(), mapMetadata);
			try {
				client.create().withMode(CreateMode.EPHEMERAL)
						.forPath(Paths.build(path, Paths.METADATA), ZooKeeperUtils.mapToBytes(mapMetadata));
			}
			catch (KeeperException.NodeExistsException ne) {
				// This is likely to happen when the container disconnects and reconnects but the admin leader
				// was not available to handle the container leaving event.
				ModuleDescriptor descriptor = module.getDescriptor();
				logger.info("The module metadata path for the module {} of type {} for {}" + "already exists.",
						descriptor.getModuleLabel(), descriptor.getType().toString(), descriptor.getGroup());
			}
		}
	}
If the provided module is not null, write its properties to the provided ZooKeeper path. If the module is null,
no action is taken.

@param client curator client
@param module module for which to write properties; may be null
@param path path to write properties to
@throws Exception
spring-xd-dirt/src/main/java/org/springframework/xd/dirt/server/container/DeploymentListener.java