public void SaveDatabaseParameters(int contactLimit, int groupLimit)
        {
            DBManager db = new DBManager();

            string saveData = "{";
            saveData += "'contact_limit':" + contactLimit + ",";
            saveData += "'group_limit':" + groupLimit;
            saveData += "}";
            SecurityManager secMng = new SecurityManager();
            saveData = secMng.EncryptText(saveData);

            db.SaveDatabaseParameters(saveData);


            ContactDB.MAX_CONTACT = contactLimit;
            GroupDB.MAX_GROUP = groupLimit;
        }
        public void LoadDatabaseParameters()
        {
            DBManager db = new DBManager();
            string text = db.LoadDatabaseParameters();
            if (!String.IsNullOrEmpty(text))
            {
                SecurityManager secMng = new SecurityManager();
                string json = secMng.DecryptText(text);

                if (!String.IsNullOrEmpty(json))
                {
                    JToken token = null;
                    try
                    {
                        token = JObject.Parse(json);
                    }
                    catch (Exception e)
                    {
                        return;
                    }
                    JToken temp = token.SelectToken("contact_limit");
                    string contact_limit = temp != null ? temp.ToString() : "";
                    temp = token.SelectToken("group_limit");
                    string group_limit = temp != null ? temp.ToString() : "";

                    int limitContact = 500;
                    Int32.TryParse(contact_limit, out limitContact);
                    limitContact = limitContact == 0 ? 500 : limitContact;

                    int limitGroup = 20;
                    Int32.TryParse(group_limit, out limitGroup);
                    limitGroup = limitGroup == 0 ? 20 : limitGroup;

                    ContactDB.MAX_CONTACT = limitContact;
                    GroupDB.MAX_GROUP = limitGroup;
                }
            }
        }