public ActionResult Edit()
        {
            CountriesService countriesService = new CountriesService();

            CountriesEditVM model = new CountriesEditVM();
            TryUpdateModel(model);

            if (!ModelState.IsValid)
            {
                return View(model);
            }

            Country country;
            if (model.ID == 0)
            {
                country = new Country();
            }
            else
            {
                country = countriesService.GetByID(model.ID);
                if (country == null)
                {
                    return RedirectToAction("List");
                }
            }

            country.ID = model.ID;
            country.Name = model.Name;
            country.Population = model.Population;
            country.FoundationDate = model.FoundationDate;

            countriesService.Save(country);

            return RedirectToAction("List");
        }
        public ActionResult Edit(int? id)
        {
            CountriesService countriesService = new CountriesService();

            CountriesEditVM model = new CountriesEditVM();
            Country country;

            if (!id.HasValue)
            {
                country = new Country();
            }
            else
            {
                country = countriesService.GetByID(id.Value);
                if (country == null)
                {
                    return RedirectToAction("List");
                }
            }

            model.ID = country.ID;
            model.Name = country.Name;
            model.Population = country.Population;
            model.FoundationDate = country.FoundationDate;

            return View(model);
        }