private async Task InitializeAdminViewModel(string username)
 {
     await Task.Run(() =>
     {
         lock (Settings.ApplicationData.DataBaseLock)
         {
             using (var dbContext = new SettingsDbContext())
             {
                 var userData = dbContext.UserDatas.Find(Settings.ApplicationData.CurrentAdminViewModel.Id);
                 if (userData == null)
                 {
                     userData = new UserData
                     {
                         AreNotificationsOn = Settings.ApplicationData.AreNotificationsOn,
                         RefreshToken       = Settings.ApplicationData.RefreshToken,
                         Email     = username,
                         IsLogedIn = true,
                         UserId    = Settings.ApplicationData.CurrentAdminViewModel.Id
                     };
                     dbContext.UserDatas.Add(userData);
                 }
                 userData.IsLogedIn = true;
                 dbContext.SaveChanges();
             }
         }
     });
 }
 public async Task Logout()
 {
     if (Settings.ApplicationData.CurrentUserViewModel != null &&
         Settings.ApplicationData.AreNotificationsOn)
     {
         _firebaseService.Unsubscribe();
     }
     Settings.ApplicationData.CurrentUserViewModel  = null;
     Settings.ApplicationData.CurrentAdminViewModel = null;
     Settings.ApplicationData.AccessToken           = string.Empty;
     Settings.ApplicationData.RefreshToken          = string.Empty;
     Settings.ApplicationData.UserData.IsLogedIn    = false;
     await Task.Run(() =>
     {
         lock (Settings.ApplicationData.DataBaseLock)
         {
             using (var dbContext = new SettingsDbContext())
             {
                 dbContext.Entry(Settings.ApplicationData.UserData).State = EntityState.Modified;
                 dbContext.SaveChanges();
             }
         }
     });
 }