public LightboxSettings GetSettings()
 {
     var settingsRecord = _settingsRepository.Table.SingleOrDefault();
     if (settingsRecord == null)
     {
         return GetDefaultSettings();
     }
     var settings = new LightboxSettings 
     {
         Enabled = settingsRecord.Enabled,
         ContainerSelector = settingsRecord.ContainerSelector,
         LinkClasses = ListUtils.StringToList(settingsRecord.LinkClasses),
         LinkRelAttributeValue = settingsRecord.LinkRelAttributeValue,
         ImageChildTagRequired = settingsRecord.ImageChildTagRequired,
         LinkToImageRequired = settingsRecord.LinkToImageRequired,   
         ImageFileExtensions = ListUtils.StringToList(settingsRecord.ImageFileExtensions),
         CustomScript = settingsRecord.CustomScript,
         CurrentTheme = settingsRecord.CurrentTheme
     };
     return settings;
 }
 public ActionResult Index(SettingsViewModel settingsViewModel)
 {
     // TODO: permissions, validation
     if (!ModelState.IsValid)
     {
         return Index();
     }
     var settings = new LightboxSettings
     {
         Enabled = settingsViewModel.Enabled,
         ContainerSelector = settingsViewModel.ContainerSelector,
         LinkClasses = ListUtils.StringToList(settingsViewModel.LinkClasses),
         LinkRelAttributeValue = settingsViewModel.LinkRelAttributeValue,
         ImageChildTagRequired = settingsViewModel.ImageChildTagRequired,
         LinkToImageRequired = settingsViewModel.LinkToImageRequired,
         ImageFileExtensions = ListUtils.StringToList(settingsViewModel.ImageFileExtensions),
         CustomScript = settingsViewModel.CustomScript
     };
     _lightboxService.SaveSettings(settings);
     return Index();
 }
 public void SaveSettings(LightboxSettings settings)
 {
     var settingsRecord = GetSettingsToUpdate();
     settingsRecord.Enabled = settings.Enabled;
     settingsRecord.ContainerSelector = settings.ContainerSelector;
     settingsRecord.LinkClasses = ListUtils.ListToString(settings.LinkClasses);
     settingsRecord.LinkRelAttributeValue = settings.LinkRelAttributeValue;
     settingsRecord.ImageChildTagRequired = settings.ImageChildTagRequired;
     settingsRecord.LinkToImageRequired = settings.LinkToImageRequired;
     settingsRecord.ImageFileExtensions = ListUtils.ListToString(settings.ImageFileExtensions);
     settingsRecord.CustomScript = settings.CustomScript;
     if (!String.IsNullOrWhiteSpace(settings.CurrentTheme))
     {
         settingsRecord.CurrentTheme = settings.CurrentTheme;
     }
 }