private List <IEnrollFactor> PrepareEnrollFactors(IAuthenticationResponse authenticationResponse)
        {
            List <IEnrollFactor> enrollFactorsList = new List <IEnrollFactor>();

            if (authenticationResponse.Embedded.GetData().ContainsKey("factors"))
            {
                string        stringResponse = JsonConvert.SerializeObject(authenticationResponse.Embedded.GetData()["factors"]);
                List <object> factorsList    = JsonConvert.DeserializeObject <List <object> >(stringResponse);
                this.OktaFactorCount = factorsList.Count;
                foreach (var factor in factorsList)
                {
                    string     factorStringResponse   = JsonConvert.SerializeObject(factor);
                    FactorInfo factorObj              = JsonConvert.DeserializeObject <FactorInfo>(factorStringResponse);
                    string     factorKey              = GetFactorKey(factorObj);
                    string     isFactorRequired       = IsFactorRequired(factorObj);
                    string     factorEnrollmentStatus = GetFactorEnrollStatus(factorObj);
                    string     factorId = GetEnrollFactorId(factorObj.FactorType);
                    factorObj.FactorKey = factorKey;
                    string[] supportedFactors = { "sms:OKTA" };
                    if (supportedFactors.Contains(factorKey) && isFactorRequired == "REQUIRED" && factorEnrollmentStatus == "NOT_SETUP")
                    {
                        IEnrollFactor enrollFactor = this.CreateEnrollFactorObject(factorObj);
                        enrollFactorsList.Add(enrollFactor);
                    }
                }
            }

            return(enrollFactorsList);
        }
        /// <summary>
        /// The CreateEnrollFactorObject
        /// </summary>
        /// <param name="factorInfo">The factorInfo<see cref="FactorInfo"/></param>
        /// <returns>The <see cref="IEnrollFactor"/></returns>
        public IEnrollFactor CreateEnrollFactorObject(FactorInfo factorInfo)
        {
            IEnrollFactor enrollFactor = null;

            if (factorInfo.FactorKey == "sms:OKTA")
            {
                SmsFactorEnroll smsFactorEnroll = new SmsFactorEnroll(this.authnClient, this)
                {
                    Id                = factorInfo.Id,
                    Profile           = factorInfo.Profile,
                    FactorType        = factorInfo.FactorType,
                    Provider          = factorInfo.Provider,
                    VendorName        = factorInfo.VendorName,
                    Links             = factorInfo.Links,
                    FactorDisplayName = "SMS Authentication",
                    Enrollment        = factorInfo.Enrollment,
                    Status            = factorInfo.Status,
                };
                enrollFactor = smsFactorEnroll;
            }

            return(enrollFactor);
        }
        /// <summary>
        /// The GetFactorKey
        /// </summary>
        /// <param name="factorObj">The factorObj<see cref="IEnrollFactor"/></param>
        /// <returns>The <see cref="string"/></returns>
        public static string GetFactorKey(IEnrollFactor factorObj)
        {
            string factorKey = factorObj.FactorType + ":" + factorObj.Provider;

            return(factorKey);
        }