/// <summary>
        /// Change the Instagram account biography
        /// </summary>
        private AutomationResult ChangeBiography(string bio)
        {
            _logger.LogInformation($"Update biography: {bio}");
            try
            {
                _driver
                .FindElement(By.Id("com.instagram.android:id/profile_tab"))
                .Click();

                _driver
                .FindElement(By.Id("com.instagram.android:id/coordinator_root_layout"))
                .FindElements(By.ClassName("android.widget.Button"))
                .First(x => x.Text.ToLower().Contains("edit profile"))
                .Click();

                FindElement(By.Id("com.instagram.android:id/bio")).Click();
                FindElement(By.Id("com.instagram.android:id/caption_edit_text")).Clear();
                FindElement(By.Id("com.instagram.android:id/caption_edit_text")).SendKeys(bio);
                FindElement(By.XPath(@"//android.widget.ViewSwitcher[@content-desc=""Done""]/android.widget.ImageView")).Click();
                FindElement(By.XPath(@"//android.widget.ViewSwitcher[@content-desc=""Done""]/android.widget.ImageView")).Click();

                return(AutomationResult.Ok());
            }
            catch (Exception e)
            {
                return(AutomationResult.Error(e.Message));
            }
        }
        private AutomationResult ChangeFullName(string fullname)
        {
            _logger.LogInformation($"Update fullname: {fullname}");

            try
            {
                _driver
                .FindElement(By.Id("com.instagram.android:id/profile_tab"))
                .Click();

                _driver
                .FindElement(By.Id("com.instagram.android:id/coordinator_root_layout"))
                .FindElements(By.ClassName("android.widget.Button"))
                .First(x => x.Text.ToLower().Contains("edit profile"))
                .Click();

                FindElement(By.Id("com.instagram.android:id/full_name")).Click();
                FindElement(By.Id("com.instagram.android:id/full_name")).FindElement(By.ClassName("android.widget.EditText")).Clear();
                FindElement(By.Id("com.instagram.android:id/full_name")).FindElement(By.ClassName("android.widget.EditText")).SendKeys(fullname);
                // _appium.Driver.FindElement(By.Id("com.instagram.android:id/caption_edit_text")).Clear();
                // _appium.Driver.FindElement(By.Id("com.instagram.android:id/caption_edit_text")).SendKeys(fullname);
                FindElement(By.XPath(@"//android.widget.ViewSwitcher[@content-desc=""Done""]/android.widget.ImageView")).Click();

                Console.ReadLine();
                FindElement(By.XPath(@"//android.widget.ViewSwitcher[@content-desc=""Done""]/android.widget.ImageView")).Click();

                return(AutomationResult.Ok());
            }
            catch (Exception e)
            {
                return(AutomationResult.Error(e.Message));
            }
        }
        /// <summary>
        /// Create an Instagram account
        /// </summary>
        /// <param name="record"></param>
        /// <exception cref="Exception">If the program crash</exception>
        private AutomationResult RegisterAccount(InstagramAccountInformation record)
        {
            try
            {
                // var multiLogin = FindElements(By.Id("com.google.android.gms:id/credential_picker_layout"));
                // if (multiLogin.Any())
                //     FindElement(By.Id("com.google.android.gms:id/cancel")).Click();

                var signupCta = FindElements(By.Id("com.instagram.android:id/sign_up_with_email_or_phone"));
                _logger.LogInformation($"Is setup CTA is present? {signupCta.Any()}");
                if (signupCta.Any())
                {
                    signupCta.First().Click();
                    FindElement(By.Id("com.instagram.android:id/right_tab")).Click();

                    FindElement(By.Id("com.instagram.android:id/email_field")).SendKeys(record.Email);
                    FindElement(By.Id("com.instagram.android:id/right_tab_next_button")).Click();

                    // is already existing account

                    var confirmationCode = GetConfirmationCode(record.Email, record.Password);
                    if (confirmationCode.IsNull())
                    {
                        throw new Exception("Unable to get confirmation code");
                    }

                    FindElement(By.Id("com.instagram.android:id/confirmation_code")).SendKeys(confirmationCode);
                    FindElement(By.Id("com.instagram.android:id/next_button")).Click();

                    FindElement(By.Id("com.instagram.android:id/full_name")).SendKeys(record.Fullname);
                    FindElement(By.Id("com.instagram.android:id/password")).SendKeys(record.Password);
                    FindElement(By.Id("com.instagram.android:id/remember_password_checkbox")).Click();
                    FindElement(By.Id("com.instagram.android:id/continue_without_ci")).Click();

                    FindElement(By.Id("com.instagram.android:id/next_button")).Click();
                    FindElement(By.Id("com.instagram.android:id/primary_button")).Click();
                    FindElement(By.Id("com.instagram.android:id/add_age_link")).Click();

                    FindElement(By.Id("com.instagram.android:id/entered_age")).SendKeys(record.Age);
                    FindElement(By.Id("com.instagram.android:id/next_button")).Click();

                    FindElement(By.Id("com.instagram.android:id/change_username")).Click();
                    FindElement(By.Id("com.instagram.android:id/username")).SendKeys(record.Username);
                    FindElement(By.Id("com.instagram.android:id/next_button")).Click();

                    FindElement(By.Id("com.instagram.android:id/skip_button")).Click();
                    // FindElement(By.Id("com.instagram.android:id/skip_button")).Click();
                    FindElement(By.Id("com.instagram.android:id/negative_button")).Click();
                    FindElement(By.Id("com.instagram.android:id/skip_button")).Click();
                    FindElement(By.Id("com.instagram.android:id/action_bar_button_action")).Click();

                    return(AutomationResult.Ok());
                }
                return(AutomationResult.Error("Unable to found the signup CTA"));
            }
            catch (Exception e)
            {
                return(AutomationResult.Error(e.Message));
            }
        }
        /// <summary>
        /// Renew the IP of the 4G proxy
        /// </summary>
        private AutomationResult RenewIp()
        {
            var client   = new RestClient($"https://hypeproxy.io/api/Utils/DirectRenewIp/{ProxyId}");
            var request  = new RestRequest(Method.GET);
            var response = client.Execute(request);

            if (response.IsSuccessful)
            {
                _logger.LogInformation($"Successfully renewed IP, new IP: {GetCurrentIp()}");
                return(AutomationResult.Ok());
            }
            else
            {
                _logger.LogError("Unable to renew IP");
                return(AutomationResult.Error("Unable to renew the IP"));
            }
        }
        /// <summary>
        /// Set account profile picture
        /// </summary>
        /// <param name="profilePicture">A valid http(s) jpg or png link</param>
        private AutomationResult ChangeProfilePicture(string profilePicture)
        {
            _logger.LogInformation($"Update profile picture: {profilePicture}");

            try
            {
                var extension  = new FileInfo(profilePicture).Extension.Replace(".", "");
                var photoBytes = new WebClient().DownloadData(profilePicture);

                // TODO: Check if the path is always the same
                _driver.PushFile($"/storage/emulated/0/DCIM/Camera/{Guid.NewGuid()}.{(string.IsNullOrWhiteSpace(extension) ? "jpg" : extension)}", photoBytes);

                _driver
                .FindElement(By.Id("com.instagram.android:id/profile_tab"))
                .Click();

                _driver
                .FindElement(By.Id("com.instagram.android:id/coordinator_root_layout"))
                .FindElements(By.ClassName("android.widget.Button"))
                .First(x => x.Text.ToLower().Contains("edit profile"))
                .Click();

                FindElement(By.Id("com.instagram.android:id/change_avatar_button")).Click();

                var hasActionSheetOpened = _driver.FindElement(By.Id("com.instagram.android:id/action_sheet_header_text_view")).Displayed;
                if (hasActionSheetOpened)
                {
                    _logger.LogInformation("First profile picture upload");
                    FindElement(By.XPath(@"/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.FrameLayout[2]/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.view.ViewGroup/androidx.recyclerview.widget.RecyclerView/android.widget.TextView[1]")).Click();
                }
                else
                {
                    _logger.LogInformation("Profile picture upload");
                    FindElement(By.XPath("/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.ListView/android.widget.FrameLayout[1]")).Click();
                }
                FindElement(By.Id("com.instagram.android:id/next_button_textview")).Click();
                FindElement(By.Id("com.instagram.android:id/next_button_textview")).Click();

                return(AutomationResult.Ok());
            }
            catch (Exception e)
            {
                return(AutomationResult.Error(e.Message));
            }
        }