public ActionResult Create()
        {
            var country = this.CountryService.Create();
            var privilege = new CountryPrivilege();

            return privilege.CanCreate(country) ? base.View(Views.Create, new CountryCreateOrUpdate()) : NotAuthorized();
        }
        public ActionResult Create(CountryCreateOrUpdate value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            var country = this.CountryService.Create();
            var privilege = new CountryPrivilege();

            if (!privilege.CanCreate(country))
            {
                return NotAuthorized();
            }

            value.Validate();

            if (value.IsValid)
            {
                value.ValueToModel(country);

                this.CountryService.InsertOrUpdate(country);

                value = new CountryCreateOrUpdate(country);
                value.SuccessMessage(Messages.CountryCreated.FormatInvariant(country.Title));
            }
            else
            {
                value.CopyToModel(ModelState);
            }

            return base.View(Views.Update, value);
        }
        public ActionResult Index(SortCountry sort, SortOrder order, int? page)
        {
            var countries = this.CountryService.GetPaged(new CountrySpecification
            {
                Page = page,
                Limit = Setting.CountryPageLimit.Value,
                Sort = sort,
                Order = order
            });

            var country = countries.FirstOrDefault();
            var privilege = new CountryPrivilege();

            return privilege.CanView(country) ? base.View(Views.Index, countries) : NotAuthorized();
        }
        public ActionResult Update(int id)
        {
            var country = this.CountryService.GetById(id);

            if (country == null)
            {
                return HttpNotFound();
            }

            var privilege = new CountryPrivilege();

            return privilege.CanUpdate(country) ? base.View(Views.Update, new CountryCreateOrUpdate(country)) : NotAuthorized();
        }
        public ActionResult Delete(CountryDelete value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            var country = this.CountryService.GetById(value.Id);

            if (country == null)
            {
                return HttpNotFound();
            }

            var privilege = new CountryPrivilege();

            if (!privilege.CanDelete(country))
            {
                return NotAuthorized();
            }

            this.CountryService.Delete(country);

            return base.RedirectToRoute(AdministrationRoutes.CountryIndex);
        }