public override string Execute() { Console.WriteLine($"Trying to update application settings..."); string message; var settings = _applicationSettingService.GetApplicationSettings().Result; Console.WriteLine("Please enter the updated application settings (leave blank if it's unchanged):"); var dto = new UpdateApplicationSettingDto { UpdatedSettings = new Dictionary <string, string>() }; foreach (var setting in settings) { string input = null; string prompt = $"{setting.Label}:"; bool validInput; do { if (setting.DataType == ApplicationSettingDataTypes.Bool) { input = Console.GetYesNoNullable(prompt)?.ToString().ToLower(); } else { input = Console.GetString(prompt); } if (setting.AllowedValues != null && setting.AllowedValues.Length > 0 && !string.IsNullOrEmpty(input) && !setting.AllowedValues.Contains(input)) { Console.WriteLine($"Input is not valid. Please enter the allowed values: {string.Join(',', setting.AllowedValues)}"); validInput = false; } else { validInput = true; } } while (!validInput); if (!string.IsNullOrEmpty(input)) { dto.UpdatedSettings.Add(setting.Key, input); } } _applicationSettingService.UpdateApplicationSetting(dto).Wait(); message = $"Application settings has been updated successfully"; Logger.LogInformation(message); return(message); }