public async Task<Account> EditAccount(Account account)
 {
     Account current = await GetAccount(account.Id);
     if (current == null)
     {
         throw new NotImplementedException();
     }
     else
     {
         accounts[account.Id] = account;
         return account;
     }
 }
        private async void DoneButton_Click(object sender, RoutedEventArgs e)
        {
            if (new[]{Name.Text, PreferredName.Text, HeightFeet.Text, HeightInches.Text,
                Weight.Text, Zip.Text}.Any(string.IsNullOrEmpty))
            {
                MessageDialog dialog = new MessageDialog("You need to fill in all fields.");
                await dialog.ShowAsync();
                return;
            }

            bool? sex = null;
            if (Sex.SelectionBoxItem == null)
            {

            }
            else if ((string)Sex.SelectionBoxItem == "Female")
            {
                sex = true;
            }
            else if ((string)Sex.SelectionBoxItem == "Male")
            {
                sex = false;
            }

            var account = new Account()
            {
                Id = "",
                FullName = Name.Text,
                PreferredName = PreferredName.Text,
                UserName = new string(Name.Text.Where(c => char.IsDigit(c) || char.IsLetter(c)).ToArray()),
                Height = int.Parse(HeightFeet.Text) * 12 + int.Parse(HeightInches.Text),
				Weight = UserState.UseOldUnits ? (int.Parse(Weight.Text) * 14) : int.Parse(Weight.Text),
                Sex = sex,
                Birthdate = Birthdate.Date.DateTime,
                Zip = int.Parse(Zip.Text)
            };

			if(info.Authenticator == Authenticator.Twitter)
			{
				account.TwitterId = info.SocialId;
			}
			else
			{
				account.FacebookId = info.SocialId;
			}

            account = await Api.Do.CreateAccount(account);

            UserState.ActiveAccount = account;
            PageDispatch.GoHome(Frame);
        }
 public Task<Account> CreateAccount(Account account)
 {
     accounts.Add(account.Id, account);
     return Task.FromResult(account);
 }