// Method to add Categories. Binding item categoryName to my Category objekt.
        public void CategoryListView_InsertItem(Category category)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    Service.SaveCategory(category);

                    Page.SetTempData("Confirmation", String.Format("Bildkategori {0} har Lags till ", category.CategoryProp));
                    Response.RedirectToRoute("CategoriesList");
                    Context.ApplicationInstance.CompleteRequest();
                }
                catch (Exception)
                {
                    ModelState.AddModelError(String.Empty, "Fel inträffade när Kategori skulle Läggas till.");
                }
            }
        }
        // Methods to make SQL Calls toward Category table.
        /// <summary>
        ///  Method to validate Categorys, and also redirect if new Category or Updating.
        /// </summary>
        /// <param name="category"></param>
        public void SaveCategory(Category category)
        {
            ICollection<ValidationResult> validationresults;
            if (!category.Validate(out validationresults))
            {
                throw new ApplicationException();
            }

            if (category.CategoryID == 0)
            {
                CategoryDAL.SaveCategory(category);
            }
            else
            {
                CategoryDAL.UpdateCategory(category);
            }
        }