public async Task <bool> SaveUserRegitration() { this.IsValid = true; if (string.IsNullOrEmpty(this.FullName)) { await MessageHelper.ShowMessage("Please provide your Name"); IsValid = false; return(false); } else if (this.City == null) { await MessageHelper.ShowMessage("Please choose your City"); IsValid = false; return(false); } else if (string.IsNullOrEmpty(this.Email)) { await MessageHelper.ShowMessage("Please provide your Email"); IsValid = false; return(false); } else if (this.SelectedAudienceType == null) { await MessageHelper.ShowMessage("What describes you best?"); IsValid = false; return(false); } else if (this.SelectedAudienceOrgType == null) { await MessageHelper.ShowMessage("Please select your Organization"); IsValid = false; return(false); } else if (this.SecondaryTechnologies.FirstOrDefault(x => x.IsSelected) == null) { await MessageHelper.ShowMessage("Please select your Technologies you are interested in"); IsValid = false; return(false); } string email = this.Email; Regex regex = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$"); Match match = regex.Match(email); if (!match.Success) { await MessageHelper.ShowMessage("Please enter valid email address"); IsValid = false; return(false); } try { this.OperationInProgress = true; var pf = new ProfileRequest() { FullName = this.FullName, Email = this.Email, AuthProvider = this.AuthProvider, AuthProviderUserId = this.AuthProviderUserId, City = this.City, SelectedAudienceType = this.SelectedAudienceType, SelectedAudienceOrgType = this.SelectedAudienceOrgType, SecondaryTechnologies = this.SecondaryTechnologies, DeviceId = this.DeviceId, DevicePlatform = NotificationsHelper.Platform, PushEnabled = this.PushEnabled, PushId = await NotificationsHelper.GetPushId(), Town = this.Town, Location = this.Location } ; // Fetch data about the user //saves and updates data on server var result = await ServiceProxy.CallService("api/Profile", JsonConvert.SerializeObject(pf)); if (result.IsSuccess) { ProfileResponse response = JsonConvert.DeserializeObject <ProfileResponse>(result.response); if (response.UserId != 0) // check if user is exsting or not ,,, if 0 means update failed. { this.DeviceId = response.DeviceId; this.UserId = response.UserId.ToString(); await LocalStorage.SaveJsonToFile(this, "registration"); return(true); } } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); return(false); } finally { this.OperationInProgress = false; } return(false); }