private async Task RegisterResourceOutputsAsync(
            Resource resource, Output <IDictionary <string, object?> > outputs)
        {
            var opLabel = $"monitor.registerResourceOutputs(...)";

            // The registration could very well still be taking place, so we will need to wait for its URN.
            // Additionally, the output properties might have come from other resources, so we must await those too.
            var urn = await resource.Urn.GetValueAsync().ConfigureAwait(false);

            var props = await outputs.GetValueAsync().ConfigureAwait(false);

            var serialized = await SerializeAllPropertiesAsync(opLabel, props).ConfigureAwait(false);

            Log.Debug($"RegisterResourceOutputs RPC prepared: urn={urn}" +
                      (_excessiveDebugOutput ? $", outputs ={JsonFormatter.Default.Format(serialized)}" : ""));

            await Monitor.RegisterResourceOutputsAsync(new RegisterResourceOutputsRequest
            {
                Urn     = urn,
                Outputs = serialized,
            });
        }