void HandleTwinResponse(string id, string res, string rid, byte[] payload)
        {
            var messageBuilder = new EdgeMessage.Builder(payload);

            messageBuilder.SetSystemProperties(
                new Dictionary <string, string>()
            {
                [SystemProperties.StatusCode]    = res,
                [SystemProperties.CorrelationId] = rid,
            });

            var message = messageBuilder.Build();

            long ridAsLong;

            if (!long.TryParse(rid, out ridAsLong)) // TODO should use as string itself to make less sensitive to the actual format?
            {
                Events.CannotParseRid(rid);
                return;
            }

            if (!this.pendingTwinRequests.TryRemove(ridAsLong, out var tsc))
            {
                Events.CannotFindRid(rid);
                return;
            }

            tsc.SetResult(message);

            Events.TwinResultReceived(id, ridAsLong);
        }
        void HandleDesiredProperyUpdate(string id, string version, byte[] payload)
        {
            var messageBuilder = new EdgeMessage.Builder(payload);

            messageBuilder.SetSystemProperties(
                new Dictionary <string, string>()
            {
                [SystemProperties.Version] = version
            });

            _ = this.edgeHub.UpdateDesiredPropertiesAsync(id, messageBuilder.Build());
        }