private void ApplyValueDiffs(RegistryKey regKey,
                                     Dictionary <string, ArgumentRegValue> toDel = null,
                                     IEnumerable <string> toDelKeys = null,
                                     Dictionary <string, ArgumentRegValue> toAdd = null,
                                     IEnumerable <string> toAddKeys = null,
                                     Dictionary <string, ArgumentRegValue> toUpd = null,
                                     IEnumerable <string> toUpdKeys = null)
        {
            if (toDel != null)
            {
                foreach (var valName in (toDelKeys ?? toDel.Keys))
                {
                    _log.LogInformation("  * deleting value: [{@valueName}]",
                                        valName);
                    regKey.DeleteValue(valName, false);
                }
            }

            // And Add and an Update are functionally the same (RegKey.SetValue(...))
            // but we split them out here for better bookkeeping and diagnostics

            if (toAdd != null)
            {
                foreach (var valName in (toAddKeys ?? toAdd.Keys))
                {
                    var valArg   = toAdd[valName];
                    var valType  = RegUtil.ParseValueKind(valArg.Type);
                    var valValue = RegUtil.ResolveValue(valArg);
                    _log.LogInformation("  * creating value: [{@valueName}]({@valueType})=[{@value}]",
                                        valName, valType, valValue);
                    regKey.SetValue(valName, valValue, valType);
                }
            }

            if (toUpd != null)
            {
                foreach (var valName in (toUpdKeys ?? toUpd.Keys))
                {
                    var valArg   = toUpd[valName];
                    var valType  = RegUtil.ParseValueKind(valArg.Type);
                    var valValue = RegUtil.ResolveValue(valArg);
                    _log.LogInformation("  * updating value: [{@valueName}]({@valueType})=[{@value}]",
                                        valName, valType, valValue);
                    regKey.SetValue(valName, valValue, valType);
                }
            }
        }