public async Task <Tuple <User, Exception> > SetupDatabase(SetupVariables setupVariables) { Exception exception = null; try { _setupRepository.SetupDatabase(); } catch (Exception exc) { exception = exc; return(Tuple.Create <User, Exception>(null, exception)); } var settings = _settingsManager.Current; settings.ForumTitle = setupVariables.ForumTitle; settings.SmtpServer = setupVariables.SmtpServer; settings.SmtpPort = setupVariables.SmtpPort; settings.MailerAddress = setupVariables.MailerAddress; settings.UseSslSmtp = setupVariables.UseSslSmtp; settings.UseEsmtp = setupVariables.UseEsmtp; settings.SmtpUser = setupVariables.SmtpUser; settings.SmtpPassword = setupVariables.SmtpPassword; settings.ServerDaylightSaving = setupVariables.ServerDaylightSaving; settings.ServerTimeZone = setupVariables.ServerTimeZone; _settingsManager.SaveCurrent(); var user = await _userService.CreateUser(setupVariables.Name, setupVariables.Email, setupVariables.Password, true, ""); user.Roles = new List <string> { PermanentRoles.Admin, PermanentRoles.Moderator }; var profile = new Profile { UserID = user.UserID, IsTos = true, IsSubscribed = true, TimeZone = setupVariables.ServerTimeZone, IsDaylightSaving = setupVariables.ServerDaylightSaving, ShowDetails = true }; await _profileService.Create(profile); var edit = new UserEdit(user, profile); await _userService.EditUser(user, edit, false, false, null, null, "", user); //PopForumsActivation.StartServicesIfRunningInstance(); return(Tuple.Create(user, exception)); }