public ActionResult Edit(CountryInfo country)
        {
            if (!ModelState.IsValid)
            {
                return View(country);
            }

            _repository.Save(country);
            TempData["message"] = string.Format("{0} has been saved", country.Name);

            return RedirectToAction("Index");
        }
        public void Save(CountryInfo country)
        {
            var index = _countries.Country.FindIndex(x => x.Guid == country.Guid);
            if (index > -1)
            {
                Edit(country, index);
            }
            else
            {
                Add(country);
            }

            SaveToXml();
        }
 private void Edit(CountryInfo country, int index)
 {
     _countries.Country[index] = country;
 }
 private void Add(CountryInfo country)
 {
     country.Guid = Guid.NewGuid();
     _countries.Country.Add(country);
 }