public async Task <UserAccountData[]> getAllAccounts(string email_Address)
        {
            //connect to the database
            bool connection_result = connectToFirebase();

            //create the array which will be returned to the user as the output of this operation
            UserAccountData[] dBAccountData = null;
            try
            {
                //connection is succesfull
                if (connection_result)
                {
                    //Query for all the account
                    Query allAccounts = db.Collection("UserAccounts").Document(email_Address).Collection("MyAccounts");

                    //get the sanpshots for the collections
                    QuerySnapshot allAccountsSnapshots = await allAccounts.GetSnapshotAsync();

                    //to variable represensts the number of accounts
                    int number_of_accounts = allAccountsSnapshots.Count;
                    //create the array for the account data
                    dBAccountData = new UserAccountData[number_of_accounts];

                    //incremeant varibale
                    int i = 0;
                    foreach (DocumentSnapshot snap in allAccountsSnapshots.Documents)
                    {
                        DBAccountData tempData = snap.ConvertTo <DBAccountData>();
                        dBAccountData[i]           = new UserAccountData();
                        dBAccountData[i].userEmail = email_Address;
                        dBAccountData[i].Name      = tempData.accountName;
                        dBAccountData[i].UserName  = tempData.accountUserName;
                        dBAccountData[i].Password  = tempData.accountPassword;
                        dBAccountData[i].Password  = tempData.accountPassword;
                        i++;
                    }
                }
            }
            catch (Exception ex)
            {
                CustomException customException = new CustomException();
                customException.errorTitleName     = "Error while getting the data from the database";
                customException.errorMessageToUser = ex.Message;
                throw new FaultException <CustomException>(customException);
            }

            return(dBAccountData);
        }
        public async Task <UserAccountData> requestDecryption(string email_Address, string accountName)
        {
            DBAccountData   dBAccountData = null;
            UserAccountData data          = null;
            //connect to the firestoredatabase
            bool connection_Result = connectToFirebase();

            try
            {
                if (connection_Result)
                {
                    DocumentReference documentReference = db.Collection("UserAccounts").Document(email_Address).Collection("MyAccounts").Document(accountName);
                    DocumentSnapshot  documentSnapshot  = await documentReference.GetSnapshotAsync();

                    if (documentSnapshot.Exists)
                    {
                        //first of all encrypt the user Data
                        //Get the User Encryption Key from the firestore database
                        DocumentReference getUserKey = db.Collection("UserEncryptionKeys").Document(email_Address);

                        //get the snapshot for the same
                        DocumentSnapshot snapshot = await getUserKey.GetSnapshotAsync();

                        if (snapshot.Exists)
                        {
                            string keyName = "";
                            Dictionary <string, object> userKeyDict = snapshot.ToDictionary();
                            foreach (KeyValuePair <string, object> pair in userKeyDict)
                            {
                                if (pair.Key == "userKeyName")
                                {
                                    keyName = pair.Value.ToString();
                                    break;
                                }
                            }

                            //Convert to the DBUserEncryption
                            //DBUserEncryptionKeys dBUserEncryptionKeys = snapshot.ConvertTo<DBUserEncryptionKeys>();
                            //string key_Name_For_Encryption = dBUserEncryptionKeys.userKeyName;

                            //Create the client for the azure KeyVault Access
                            var client = new KeyClient(vaultUri: new Uri(KeyVaultUrl), credential: new ClientSecretCredential(tenantId, clientid, client_secret));

                            //Retrive the key from the azure Key Vault
                            KeyVaultKey key = await client.GetKeyAsync(keyName);

                            //Now Creating the Crypto Client for the Encryption of the user Data
                            var cryptoClient = new CryptographyClient(keyId: key.Id, credential: new ClientSecretCredential(tenantId, clientid, client_secret));

                            //get the Account Details
                            DocumentReference documentReference_for_getting_data = db.Collection("UserAccounts").Document(email_Address).Collection("MyAccounts").Document(accountName);

                            //get the snapshots for the document
                            DocumentSnapshot documentSnapshot_for_getting_data = await documentReference_for_getting_data.GetSnapshotAsync();

                            if (documentSnapshot_for_getting_data.Exists)
                            {
                                //intiliaze the AccountData object and conver the snapshot to the Account Data object
                                dBAccountData = new DBAccountData();
                                dBAccountData = documentSnapshot_for_getting_data.ConvertTo <DBAccountData>();

                                //perform the decryption
                                DecryptResult decryptResult_for_userName = await cryptoClient.DecryptAsync(EncryptionAlgorithm.RsaOaep, Convert.FromBase64String(dBAccountData.accountUserName));

                                DecryptResult decryptResult_for_password = await cryptoClient.DecryptAsync(EncryptionAlgorithm.RsaOaep, Convert.FromBase64String(dBAccountData.accountPassword));

                                //convert decrypted result to the string
                                string decrypted_username_plaintext = Encoding.UTF8.GetString(decryptResult_for_userName.Plaintext);
                                string decrypted_password_plaintext = Encoding.UTF8.GetString(decryptResult_for_password.Plaintext);

                                //chnage the decrypted string to the plaintext
                                dBAccountData.accountUserName = decrypted_username_plaintext;
                                dBAccountData.accountPassword = decrypted_password_plaintext;

                                data           = new UserAccountData();
                                data.userEmail = email_Address;
                                data.Name      = dBAccountData.accountName;
                                data.UserName  = dBAccountData.accountUserName;
                                data.Password  = dBAccountData.accountPassword;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                CustomException customException = new CustomException();
                customException.errorTitleName     = "Error Occured while performing the decryption of the Username ans Password";
                customException.errorMessageToUser = ex.Message;
                throw new FaultException <CustomException>(customException);
            }
            return(data);
        }