public SettingsDTO UpdateSettings(string username, SettingsDTO dto) { var acc = accountService.GetAccountForUser(username); if (acc == null) { throw new Exception("Such account doesn't exist!"); } var settings = settingsRepository.GetById(acc.SettingsId); var newSettings = SettingsConverter.ToEntity(dto); newSettings.Id = settings.Id; settingsRepository.Save(newSettings); return(dto); }