/// <summary>
        /// List of all content pages
        /// </summary>
        /// <returns></returns>
        public List <ContentPage> ListContentPages()
        {
            MySqlConnection Connect = new MySqlConnection(ConnectionString);

            //Create a blank list of contentpages
            List <ContentPage> ContentPages_List = new List <ContentPage>();

            try
            {
                //Query for fetching all data
                string query = "select * from content_pages order by publishdate desc";

                //open the db connection
                Connect.Open();

                //Run out query
                MySqlCommand cmd = new MySqlCommand(query, Connect);
                //grab the result set
                MySqlDataReader resultset = cmd.ExecuteReader();

                //read through the result set
                while (resultset.Read())
                {
                    //information that will store a single content page
                    ContentPage Current_ContentPage = new ContentPage();

                    //Look at each column in the result set row, add both the column name and the column value to our Content page dictionary
                    for (int i = 0; i < resultset.FieldCount; i++)
                    {
                        string key   = resultset.GetName(i);
                        string value = resultset.GetString(i);

                        switch (key)
                        {
                        case "page_id":
                            Current_ContentPage.Id = Convert.ToInt32(value);
                            break;

                        case "pagetitle":
                            Current_ContentPage.Title = value;
                            break;

                        case "pagebody":
                            Current_ContentPage.Body = value;
                            break;

                        case "publishdate":
                            Current_ContentPage.PublishDate = Convert.ToDateTime(value);
                            break;

                        case "is_published":
                            Current_ContentPage.Is_Published = Convert.ToBoolean(value);
                            break;
                        }
                    }
                    //Add the content page to the list of content pages
                    ContentPages_List.Add(Current_ContentPage);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Something went wrong in the List Content Pages method!");
                Debug.WriteLine(ex.ToString());
            }

            Connect.Close();
            return(ContentPages_List);
        }
        /// <summary>
        /// Get content page detail by id.
        /// </summary>
        /// <param name="contentpage_id">Id of content page</param>
        /// <returns></returns>
        public ContentPage GetContentPageById(int contentpage_id)
        {
            MySqlConnection Connect = new MySqlConnection(ConnectionString);

            //Create a blank  contentpages
            ContentPage Result_ContentPage = new ContentPage();

            try
            {
                //Query for fetching data by content page id
                string query = "select * from content_pages where page_id = {0}";
                query = String.Format(query, contentpage_id);

                //open the db connection
                Connect.Open();

                //Run out query
                MySqlCommand cmd = new MySqlCommand(query, Connect);
                //grab the result set
                MySqlDataReader resultset = cmd.ExecuteReader();

                List <ContentPage> ContentPages = new List <ContentPage>();

                //read through the result set
                while (resultset.Read())
                {
                    //information that will store a single content page
                    ContentPage Current_ContentPage = new ContentPage();

                    //Look at each column in the result set row, add both the column name and the column value to our Content page dictionary
                    for (int i = 0; i < resultset.FieldCount; i++)
                    {
                        string key   = resultset.GetName(i);
                        string value = resultset.GetString(i);

                        switch (key)
                        {
                        case "page_id":
                            Current_ContentPage.Id = Convert.ToInt32(value);
                            break;

                        case "pagetitle":
                            Current_ContentPage.Title = value;
                            break;

                        case "pagebody":
                            Current_ContentPage.Body = value;
                            break;

                        case "publishdate":
                            Current_ContentPage.PublishDate = Convert.ToDateTime(value);
                            break;
                        }
                    }
                    //Add the content page to the list of content pages
                    ContentPages.Add(Current_ContentPage);
                }

                Result_ContentPage = ContentPages[0]; //get the first content page
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Something went wrong in the GetContentPageById method!");
                Debug.WriteLine(ex.ToString());
            }

            Connect.Close();
            return(Result_ContentPage);
        }