write Mediator pattern