public IActionResult CMSIndexPage(CMSIndexViewModel model)
        {
            

            if(ModelState.IsValid == true)
            {
                string ImgPath1 = "";
                string ImgPath2 = "";
                string ImgPath3 = "";

                CMSIndexPageModel page = new CMSIndexPageModel();

                page.Id = model.Page.Id;
                page.Header_H1 = model.Page.Header_H1;
                page.Header_P1_Welcome = model.Page.Header_P1_Welcome;
                page.About_1_H3 = model.Page.About_1_H3;
                page.About_2_H3 = model.Page.About_2_H3;
                page.About_3_H3 = model.Page.About_3_H3;
                page.About_1_Text = model.Page.About_1_Text;
                page.About_2_Text = model.Page.About_2_Text;
                page.About_3_Text = model.Page.About_3_Text;
                page.Contact_H3 = model.Page.Contact_H3;
                page.Contact_P = model.Page.Contact_P;
                page.Contact_Phone_1 = model.Page.Contact_Phone_1;
                page.Contact_Phone_2 = model.Page.Contact_Phone_2;
                page.Contact_Email_1 = model.Page.Contact_Email_1;
                page.Contact_Email_2 = model.Page.Contact_Email_2;
                page.Contact_Address_Street = model.Page.Contact_Address_Street;
                page.Contact_Address_Postcode = model.Page.Contact_Address_Postcode;
                page.Contact_Address_City = model.Page.Contact_Address_City;

                //If there was an old image and user is editing one then chage image
                if (model.Photo1 != null)
                {
                    string filepath = Path.Combine(_hostingEnvironment.WebRootPath, "images", model.Page.About_1_Img_Path);
                    System.IO.File.Delete(filepath);

                    ImgPath1 = ProcessUploadedFile1(model);
                }

                //If there was an old image and user is editing one then chage image
                if (model.Photo2 != null)
                {
                    string filepath = Path.Combine(_hostingEnvironment.WebRootPath, "images", model.Page.About_2_Img_Path);
                    System.IO.File.Delete(filepath);

                    ImgPath2 = ProcessUploadedFile2(model);
                }

                //If there was an old image and user is editing one then chage image
                if (model.Photo3 != null)
                {
                    string filepath = Path.Combine(_hostingEnvironment.WebRootPath, "images", model.Page.About_3_Img_Path);
                    System.IO.File.Delete(filepath);

                    ImgPath3 = ProcessUploadedFile3(model);
                }

                if (ImgPath1 != "")
                {
                    page.About_1_Img_Path = ImgPath1;
                }
                else
                {
                    page.About_1_Img_Path = model.Page.About_1_Img_Path;
                }

                if (ImgPath2 != "")
                {
                    page.About_2_Img_Path = ImgPath2;
                }
                else
                {
                    page.About_2_Img_Path = model.Page.About_2_Img_Path;
                }

                if (ImgPath3 != "")
                {
                    page.About_3_Img_Path = ImgPath3;
                }
                else
                {
                    page.About_3_Img_Path = model.Page.About_3_Img_Path;
                }

                _cMSIndexRepository.Update(page);

                return RedirectToAction("Index" , "Home");
            }

            return View();

        }