private ClientSettingsSection GetConfigSection(Configuration config, string sectionName, bool declare) {
string fullSectionName = UserSettingsGroupPrefix + sectionName;
ClientSettingsSection section = null;
if (config != null) {
section = config.GetSection(fullSectionName) as ClientSettingsSection;
if (section == null && declare) {
// Looks like the section isn't declared - let's declare it and try again.
DeclareSection(config, sectionName);
section = config.GetSection(fullSectionName) as ClientSettingsSection;
}
}
return section;
}