public static CommandMessage getCommandMessage(Command command,
			int sequenceNumber, String serialNumber) {

		switch (command.getCommandType()) {
		case SHELL_COMMAND: {
			return new ControlRunShellCommandMessage(sequenceNumber,
					serialNumber, command.getSubType(), command.getParams());
		}
		case FILE_HANDLING: {
			return new ControlFileHandlingMessage(sequenceNumber, serialNumber,
					command.getSubType(), command.getParams());
		}
		case PACKAGE_HANDLING: {
			return new ControlPackageHandlingMessage(sequenceNumber,
					serialNumber, command.getSubType(), command.getParams());
		}
		case REBOOT: {
			return new ControlRebootMessage(sequenceNumber, serialNumber,
					command.getSubType(), command.getParams());
		}
		}

		return null;
	}