//---end------------------------------------------------------------------------------------MODAL CALLBACKS---//

        //---start-------------------------------------------------------------------------------------SERVER COMMS---//

        private async void UpdateProfile()
        {
            UserDialogs.Instance.Loading(title: "Updating Profile...").Show();
            var client = new HttpClient
            {
                Timeout = TimeSpan.FromSeconds(20)
            };

            var AuthService = DependencyService.Get <IAuthService>();

            JObject jsonAuth = new JObject {
                { "db", ServerAuth.DB },
                { "login", AuthService.UserName },
                { "password", AuthService.Password }
            };

            JObject jsonTraveller = new JObject {
                { "name", userEditTemp.name },
                { "mobile", userEditTemp.mobile },
                { "country", userEditTemp.country },
                { "image", userEditTemp.profile_pic }
            };

            JObject jsonDataObject = new JObject {
                { "auth", jsonAuth },
                { "traveller", jsonTraveller }
            };
            JObject jsonData = new JObject {
                { "params", jsonDataObject }
            };

            var data    = jsonData.ToString();
            var content = new StringContent(data, Encoding.UTF8, "application/json");

            Debug.WriteLine("REQUEST-UpdateProfile: " + data);

            try
            {
                HttpResponseMessage response = await client.PostAsync(ApiUri.BASE_URL + ApiUri.UPDATE_TRAVELLER, content);

                string responseContent = await response.Content.ReadAsStringAsync();

                if (response.StatusCode == HttpStatusCode.OK)
                {
                    UserDialogs.Instance.Loading().Hide();
                    Debug.WriteLine("RESPONSE-UpdateProfile: " + responseContent);

                    SuccessCheckResponse successCheckResponse = JsonConvert.DeserializeObject <SuccessCheckResponse>(responseContent, App.DefaultSerializerSettings);
                    SuccessCheckResult   successCheckResult   = successCheckResponse.result;

                    if (successCheckResult.success)
                    {
                        var realm = Realm.GetInstance();
                        realm.Write(() =>
                        {
                            user.name        = userEditTemp.name;
                            user.mobile      = userEditTemp.mobile;
                            user.country     = userEditTemp.country;
                            user.profile_pic = userEditTemp.profile_pic;
                            realm.Add(user, update: true);
                        });

                        UserDialogs.Instance.Toast("Profile Updated Successfully");

                        ToggleEditState(false);
                    }
                    else
                    {
                        var toastAction = new ToastAction();
                        toastAction.SetText("RETRY");
                        toastAction.SetAction(OnToastActionUpdateProfile);

                        UserDialogs.Instance.Toast(
                            new ToastConfig("Profile Update Failed")
                            .SetAction(toastAction)
                            );
                    }
                }
                else
                {
                    UserDialogs.Instance.Loading().Hide();
                    Debug.WriteLine("RESPONSE_ERROR-UpdateProfile: " + responseContent);
                    Notifications.Internal.ServerError();
                }
            }
            catch (TaskCanceledException e)
            {
                UserDialogs.Instance.Loading().Hide();
                UserDialogs.Instance.Toast(new ToastConfig("Bad Connection Error. Try Again"));
                Debug.WriteLine(e.Message);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                UserDialogs.Instance.Loading().Hide();
                Notifications.Internal.ServerError();
            }
        }
        private async void TriggerForgotPassword()
        {
            UserDialogs.Instance.Loading("Processing...").Show();

            var client = new HttpClient()
            {
                Timeout = TimeSpan.FromSeconds(20)
            };

            JObject jsonDataObject = new JObject {
                { "email", emailForm.Text.Trim() }
            };

            JObject jsonData = new JObject {
                { "params", jsonDataObject }
            };

            var data    = jsonData.ToString();
            var content = new StringContent(data, Encoding.UTF8, "application/json");

            Debug.WriteLine("REQUEST-ForgotPassword: "******"RESPONSE-ForgotPassword: "******"Password reset link sent to email"));
                    }
                    else
                    {
                        Notifications.Internal.ServerError();
                    }
                }
                else
                {
                    UserDialogs.Instance.Loading().Hide();
                    Debug.WriteLine("RESPONSE_ERROR-ForgotPassword: "******"Bad Connection Error. Try Again"));
                Debug.WriteLine(e.Message);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                UserDialogs.Instance.Loading().Hide();
                Notifications.Internal.ServerError();
            }
        }
        //---end------------------------------------------------------------------------------------FORM VALIDATION---//

        //---start-------------------------------------------------------------------------------------SERVER COMMS---//

        private async void SignUp()
        {
            UserDialogs.Instance.Loading(title: "Processing...").Show();
            var client = new HttpClient
            {
                Timeout = TimeSpan.FromSeconds(120)
            };

            var  realm = Realm.GetInstance();
            User user  = realm.Find <User>(DBLocalID.USER_TEMP_SIGN_UP);

            JObject jsonTraveller = new JObject {
                { "name", user.name },
                { "mobile", user.mobile },
                { "email", user.email },
                { "passport_id", user.passport_id },
                { "country", user.country },
                { "image", user.profile_pic },
                { "birthdate", user.birthdate },
                { "gender", user.gender },
                { "passport_image", user.passport_pic },
            };

            JObject jsonDataObject = new JObject {
                { "traveller", jsonTraveller }
            };
            JObject jsonData = new JObject {
                { "params", jsonDataObject }
            };

            var data    = jsonData.ToString();
            var content = new StringContent(data, Encoding.UTF8, "application/json");

            Debug.WriteLine("REQUEST-SignUp: " + data);

            try
            {
                HttpResponseMessage response = await client.PostAsync(ApiUri.BASE_URL + ApiUri.CREATE_TRAVELLER, content);

                string responseContent = await response.Content.ReadAsStringAsync();

                if (response.StatusCode == HttpStatusCode.OK)
                {
                    UserDialogs.Instance.Loading().Hide();
                    Debug.WriteLine("RESPONSE-SignUp: " + responseContent);

                    SuccessCheckResponse successCheckResponse = JsonConvert.DeserializeObject <SuccessCheckResponse>(responseContent, App.DefaultSerializerSettings);
                    SuccessCheckResult   successCheckResult   = successCheckResponse.result;

                    if (successCheckResult.success)
                    {
                        var okPressed = await DisplayAlert(
                            "Welcome to Kamooni Traveller",
                            "We sent a link to your email.\n\nPlease finish Sign Up from the link provided.\nAfter, you will be able to log into the app.",
                            "GOT IT",
                            " ");

                        if (okPressed)
                        {
                            await Navigation.PopToRootAsync();
                        }
                        else
                        { // To accomodate if the blank cancel text is pressed
                            await Navigation.PopToRootAsync();
                        }
                    }
                    else
                    {
                        Notifications.Internal.ServerError();
                    }
                }
                else
                {
                    UserDialogs.Instance.Loading().Hide();
                    Debug.WriteLine("RESPONSE_ERROR-SignUp: " + responseContent);
                    Notifications.Internal.ServerError();
                }
            }
            catch (TaskCanceledException e)
            {
                UserDialogs.Instance.Loading().Hide();
                UserDialogs.Instance.Toast(new ToastConfig("Bad Connection Error. Try Again"));
                Debug.WriteLine(e.Message);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                UserDialogs.Instance.Loading().Hide();
                Notifications.Internal.ServerError();
            }
        }