public async Task <LoginResult> Login(string emailAdress, string password) { LoginResult result = new LoginResult(); var credentials = CredentialUtil.GetCredential("BalanceKeeper.Desktop" + emailAdress); if (emailAdress != null && credentials != null && credentials.Username == emailAdress && password == credentials.Password) { result.IsError = false; SetCurrentUser(emailAdress); SQLiteStarter starter = new SQLiteStarter(); starter.Start(new Action(() => { IUserProvider desktopUserProvider = ServiceResolver.GetContainer().GetInstance <IUserProvider>(); desktopUserProvider.SetUserId(LoginRepository.Instance.CurrentUser.ID); })); starter.CreateDBIfNotExists(); await RepositoryResolver.GetRepository <ITransactionRepository>().CreateInitialFilling(); } else { result.IsError = true; result.ErrorType = LoginErrorType.WrongCredentials; } return(await Task <LoginResult> .FromResult(result)); }