/// <summary>
        ///     This will return true if a pincode is required before the app can be accessed.
        /// </summary>
        /// <returns></returns>
        public static bool IsPincodeRequired()
        {
            AuthStorageHelper auth = GetAuthStorageHelper();
            // a flag is set if the timer was exceeded at some point. Automatically return true if the flag is set.
            bool required = auth.RetrieveData(PincodeRequired) != null;

            if (required)
            {
                PlatformAdapter.SendToCustomLogger("AuthStorageHelper.IsPincodeRequired - Pincode is required", LoggingLevel.Verbose);
                return(true);
            }
            if (IsPincodeSet())
            {
                MobilePolicy policy = GetMobilePolicy();
                if (policy != null)
                {
                    string time = auth.RetrieveData(PinBackgroundedTimeKey);
                    if (time != null)
                    {
                        DateTime previous = DateTime.Parse(time);
                        DateTime current  = DateTime.Now.ToUniversalTime();
                        TimeSpan diff     = current.Subtract(previous);
                        if (diff.Minutes >= policy.ScreenLockTimeout)
                        {
                            // flag that requires pincode to be entered in the future. Until the flag is deleted a pincode will be required.
                            auth.PersistData(true, PincodeRequired, time);
                            PlatformAdapter.SendToCustomLogger("AuthStorageHelper.IsPincodeRequired - Pincode is required", LoggingLevel.Verbose);
                            return(true);
                        }
                    }
                }
            }
            // We aren't requiring pincode, so remove the flag.
            auth.DeleteData(PincodeRequired);
            PlatformAdapter.SendToCustomLogger("AuthStorageHelper.IsPincodeRequired - Pincode is not required", LoggingLevel.Verbose);
            return(false);
        }