/// <summary>
        /// Adds the Data base
        /// </summary>
        /// <param name="strDBName"></param>
        /// <returns></returns>
        public Boolean AddData(String strDBName, String strTableName, Person objData)
        {
            //Declarations
            Boolean blnFlag = false;
            MongoDatabase objDB = GetServer().GetDatabase(strDBName);

            try
            {
                //Get the table
                MongoCollection objTable = objDB.GetCollection(strTableName);

                //Insert the data
                objTable.Insert(objData);
                objTable.Save(objData);
                blnFlag = true;
            }
            catch (Exception ex)
            {
                Logger.Log("AddData: " + ex.Message);
            }

            return blnFlag;
        }
 /// <summary>
 /// Copies the data from the given instance
 /// </summary>
 /// <param name="person"></param>
 public void Copy(Person person)
 {
     this.Volunteer = person.Volunteer;
     this.FullName = person.FullName;
     this.DayOfBirth = person.DayOfBirth;
     this.EmailAddress = person.EmailAddress;
     this.MonthOfBirth = person.MonthOfBirth;
     this.YearOfBirth = person.YearOfBirth;
     this.PhoneNumber = person.PhoneNumber;
     this.StreetAddress = person.StreetAddress;
     this.City = person.City;
     this.State = person.State;
     this.Zip = person.Zip;
     this.SpouseName = person.SpouseName;
     this.Children = person.Children;
     this.GrandChildren = person.GrandChildren;
     this.PastEmployers = person.PastEmployers;
     this.CurrentEmployers = person.CurrentEmployers;
     this.LastUpdatedOn = person.LastUpdatedOn;
 }
        /// <summary>
        /// Persists the user PII data to the database
        /// </summary>
        private void PersistData()
        {
            try
            {
                Person person;
                Char[] splitter = new Char[] { ',' };
                String tableName, dataBaseName;

                //Get the table name and datatbase name from the configuration file
                tableName = Configurations.TableName;
                dataBaseName = Configurations.DatabaseName;

                //Check if the data is valid
                if (!ValidateData())
                    return;

                person = new Person
                {
                    Volunteer = lblName.Text.Trim(),
                    Children = txtChildren.Text.Trim().Split(splitter),
                    GrandChildren = txtGrandChildren.Text.Trim().Split(splitter),
                    City = txtCity.Text,
                    CurrentEmployers = txtCurrentEmployer.Text.Trim().Split(splitter),
                    MonthOfBirth = drpMonth.SelectedValue,
                    DayOfBirth = drpDay.SelectedValue,
                    YearOfBirth = drpYear.SelectedValue,
                    EmailAddress = txtEmail.Text.Trim(),
                    FullName = txtName.Text.Trim(),
                    PastEmployers = txtPastEmployer.Text.Trim().Split(splitter),
                    PhoneNumber = txtPhone1.Text.Trim() + "-" + txtPhone2.Text.Trim() + "-" + txtPhone3.Text.Trim(),
                    SpouseName = txtSpouse.Text.Trim(),
                    State = txtState.Text.Trim(),
                    StreetAddress = txtStreet.Text.Trim(),
                    Zip = txtZip.Text.Trim(),
                    LastUpdatedOn = DateTime.Now.ToShortDateString()
                };

                //Insert the data to database
                DBUtility dbUtility = new DBUtility();
                dbUtility.UpdateData(dataBaseName, tableName, person);

                DisplayMessage("Successfully updated your data");
            }
            catch (Exception ex)
            {
                DisplayMessage("Unable to update your data");
                Logger.Log("PersistData: " + ex.Message);
            }
        }
        /// <summary>
        /// Updates the existing data if present else inserts it as a new record
        /// </summary>
        /// <param name="strDataBaseName"></param>
        /// <param name="strTableName"></param>
        /// <param name="person"></param>
        /// <returns></returns>
        public Boolean UpdateData(String strDataBaseName, String strTableName, Person person)
        {
            //Declarations
            MongoCollection<Person> colData = GetServer().GetDatabase(strDataBaseName).GetCollection<Person>(strTableName);
            Boolean isExistingData = false;

            try
            {
                QueryDocument queryDocument = new QueryDocument("Volunteer", person.Volunteer);
                foreach (Person personToUpdate in colData.Find(queryDocument))
                {
                    if (personToUpdate.FullName != String.Empty)
                    {
                        personToUpdate.Copy(person);
                        colData.Save(personToUpdate);
                        isExistingData = true;
                        break;
                    }
                }

                //If its not an existing data
                if (!isExistingData)
                    colData.Save(person);

            }
            catch (Exception ex)
            {
                Logger.Log("UpdateData: " + ex.Message);

            }

            return true;
        }