public static Payload Convert(CommonResponse response) { var body = new Google.Protobuf.WellKnownTypes.Any { // convert the request paramter to a json string, as the body Value = Google.Protobuf.ByteString.CopyFromUtf8(response.ToJsonString()) }; var payload = new Payload { Body = body }; payload.Metadata = new Metadata { Type = response.GetRemoteType(), }; return(payload); }