BaconographyWP8.PlatformServices.UserService.AddOrUpdateWindowsCredential C# (CSharp) Method

AddOrUpdateWindowsCredential() private method

private AddOrUpdateWindowsCredential ( UserCredential existingCredential, string password, string lastCookie ) : void
existingCredential BaconographyPortable.Model.Reddit.UserCredential
password string
lastCookie string
return void
        private async void AddOrUpdateWindowsCredential(UserCredential existingCredential, string password, string lastCookie)
        {
			var userInfoDb = await GetUserInfoDB();
			try
			{

				var passwordCursor = await userInfoDb.SelectAsync(userInfoDb.GetKeys().First(), "passwords", DBReadFlags.AutoLock);
				if (passwordCursor != null)
				{
					using (passwordCursor)
					{
						do
						{
							var passwordData = JsonConvert.DeserializeObject<PasswordData>(passwordCursor.GetString());
							if (lastCookie == passwordData.LastCookie)
							{
								var newPassData = new PasswordData { Password = password, LastCookie = existingCredential.LoginCookie };
								await passwordCursor.UpdateAsync(JsonConvert.SerializeObject(newPassData));
								break;
							}
						} while (await passwordCursor.MoveNextAsync());
					}
				}
			}
			catch
			{
				//let it fail
			}
        }