Another option for being able to set the registry at once is to have a separate Registry type which you can add the types to. This way, the values are already validated so it avoids this whole loop on each use.