//This method retruns the user selected question at the time of the registration
        public async Task <string> getUserQuestion(string email)
        {
            string security_question = "";

            try
            {
                Boolean connectionResult = connectToFirebase();
                if (connectionResult)
                {
                    DocumentReference docRef1  = db.Collection("User").Document(email);
                    DocumentSnapshot  docSnap1 = await docRef1.GetSnapshotAsync();

                    User userObj = docSnap1.ConvertTo <User>();
                    DocumentReference docRef2  = db.Collection("Questions").Document(userObj.questionSelected.ToString());
                    DocumentSnapshot  docSnap2 = await docRef2.GetSnapshotAsync();

                    DBQuestions question = docSnap2.ConvertTo <DBQuestions>();
                    security_question = question.question;
                }
                return(security_question);
            }
            catch (Exception ex)
            {
                //catch the exception and throw the error on the client
                CustomException customException = new CustomException();
                customException.errorTitleName     = ex.Message;
                customException.errorMessageToUser = "******";
                throw new FaultException <CustomException>(customException);
            }
        }
        //This method gets the security question from the Firestore database
        public async Task <string[]> getQuestions()
        {
            string[] questions = null; //declare the array of string to return to the user
            //starting of try catch block
            try
            {
                //Connection to the database
                Boolean connectionResult = connectToFirebase();
                //Connection is successfull
                if (connectionResult)
                {
                    //create  the query to get the questions
                    Query queryRef = db.Collection("Questions");
                    ///get the snapshots for getting the question
                    QuerySnapshot snaps = await queryRef.GetSnapshotAsync();

                    //increment variable
                    int cntQues = 0;
                    foreach (DocumentSnapshot snap in snaps)
                    {
                        cntQues++;//increment the variable
                    }//end of foreach loop
                    questions = new string[cntQues];
                    int i = 0;
                    foreach (DocumentSnapshot snap in snaps)
                    {
                        //get the question from each document snapshot
                        DBQuestions questionObj = snap.ConvertTo <DBQuestions>();
                        questions[i] = questionObj.question;
                        i++;
                    } //end of foreach loop
                }     //end of IF connection result
            }         //end of try block
            catch (Exception ex)
            {
                CustomException customException = new CustomException();
                customException.errorTitleName     = ex.Message;
                customException.errorMessageToUser = "******";
                throw new FaultException <CustomException>(customException);
            }//end of catch block
            //return the question to the client
            return(questions);
        }