public static ValueSet InvokeChannel(this AppServiceConnection connection, Type contractType, object argument,
string method)
{
//Create a new instance of the channel writer and format the message (format: <Method> <Argument - can be null and is serialized as JSON>)
var channelWriteHelper = new ChannelWriteHelper(contractType);
var message = channelWriteHelper.FormatOutput(argument, method);
//Send the message with the key being the contract name and the value being the serialized message
var sendMessageTask = connection.SendMessageAsync(new ValueSet {{contractType.Name, message}}).AsTask();
sendMessageTask.Wait();
//If the message send resulted in a failure, return null, otherwise return the ValueSet result
return sendMessageTask.Result.Status != AppServiceResponseStatus.Success
? null
: sendMessageTask.Result.Message;
}