private void ReplaceConfigurationSectionRecords(Configuration configuration, object completeConfigurationRecord) { var fieldInfo = configuration.GetType().GetField("_configRoot", BindingFlags.NonPublic | BindingFlags.Instance); var configRoot = fieldInfo.GetValue(configuration); fieldInfo = configRoot.GetType().GetField( "_rootConfigRecord", BindingFlags.NonPublic | BindingFlags.Instance); var rootConfigRecord = fieldInfo.GetValue(configRoot); fieldInfo = BaseConfigurationRecordType.GetField("_sectionRecords", BindingFlags.NonPublic | BindingFlags.Instance); fieldInfo.SetValue(rootConfigRecord, fieldInfo.GetValue(completeConfigurationRecord)); }