public ActionResult AddEditCountry(CountryModel model)
        {
            int        result     = 0;
            CountryBLL countryBLL = new CountryBLL();

            if (model.CountryId == 0)
            {
                if (!Convert.ToBoolean(Session["IsAdd"]))
                {
                    return(View("ErrorPage"));
                }
            }
            else
            {
                if (!Convert.ToBoolean(Session["IsEdit"]))
                {
                    return(View("ErrorPage"));
                }
            }

            try
            {
                if (ModelState.IsValid)
                {
                    if (model.CountryId == 0)
                    {
                        var checkDuplicate = objdb.Countries.Where(x => x.CountryName == model.CountryName).FirstOrDefault();
                        if (checkDuplicate == null)
                        {
                            int res = countryBLL.AddEditCountry(new CountryModel
                            {
                                CountryName = model.CountryName,
                                CountryCode = model.CountryCode,
                                IsActive    = model.IsActive,
                                CreatedBy   = Convert.ToInt32(Session["UserId"]),
                            });
                            if (res != 0)
                            {
                                Session["Success"] = "Successfully Added The Record";
                                return(RedirectToAction("Country"));
                            }
                        }

                        Session["Error"] = "Record Already Exists";
                        return(RedirectToAction("AddEditCountry"));
                    }
                    else
                    {
                        if (model.CountryId == 0)
                        {
                            Session["Error"] = "Record Already Exists";
                            return(RedirectToAction("AddEditCountry"));
                        }
                        else
                        {
                            model.UpdatedBy = Convert.ToInt32(Session["UserId"]);
                            result          = countryBLL.AddEditCountry(model);

                            if (result != 0)
                            {
                                Session["Success"] = "Successfully Updated The Record";
                                return(RedirectToAction("Country"));
                            }
                        }
                    }
                }
                return(View(model));
            }
            catch (Exception)
            {
                Session["Error"] = "An Error has occured";
                return(View(model));

                throw;
            }
        }