public ActionResult AddCategory(CategoryViewModel model, HttpPostedFileBase file,
                                        HttpPostedFileBase fileIcon)
        {
            var pageNumber = TempData["IndexPage"];

            TempData["Title"] = model.Id == 0 ? Resource.add_service : Resource.edit_service;
            var date = DateTime.Now.ToString("yyyy-dd-M--HH-mm-ss").Replace("-", "_");

            if (ModelState.IsValid)
            {
                if (file != null)
                {
                    IList <string> AllowedFileExtensions = new List <string> {
                        ".jpg", ".png", ".jpeg", ".JPG", ".PNG", ".JPEG"
                    };
                    var ext = System.IO.Path.GetExtension(file.FileName);

                    var fileName = Path.GetFileNameWithoutExtension(file.FileName) + "_" + date + ext.ToLower();
                    //var fileName = System.IO.Path.GetFileNameWithoutExtension(file.FileName) + ext.ToLower();

                    if (!AllowedFileExtensions.Contains(ext))
                    {
                        ViewBag.ErrorMessage = Resource.file_extension_invalid;
                    }
                    ext = Path.GetExtension(file.FileName);
                    {
                        string path = "~/Images/Category";
                        if (!Directory.Exists(Server.MapPath(path)))
                        {
                            Directory.CreateDirectory(Server.MapPath(path));
                        }

                        path = System.IO.Path.Combine(Server.MapPath(path),
                                                      System.IO.Path.GetFileName(fileName));
                        file.SaveAs(path);
                        model.Picture = fileName;
                    }
                }
                if (fileIcon != null)
                {
                    IList <string> AllowedFileExtensions = new List <string> {
                        ".jpg", ".png", ".jpeg", ".JPG", ".PNG", ".JPEG"
                    };
                    var ext = System.IO.Path.GetExtension(fileIcon.FileName);

                    var fileName = System.IO.Path.GetFileNameWithoutExtension(fileIcon.FileName) + ext.ToLower();

                    if (!AllowedFileExtensions.Contains(ext))
                    {
                        ViewBag.ErrorMessage = Resource.file_extension_invalid;
                    }
                    ext = Path.GetExtension(fileIcon.FileName);
                    {
                        string path = "~/Images/Category";
                        if (!Directory.Exists(Server.MapPath(path)))
                        {
                            Directory.CreateDirectory(Server.MapPath(path));
                        }

                        path = System.IO.Path.Combine(Server.MapPath(path),
                                                      System.IO.Path.GetFileName(fileName));
                        fileIcon.SaveAs(path);
                        model.Icon = fileName;
                    }
                }
                var result = categoryService.AddUpdateCategory(model);
                if (result)
                {
                    TempData["SuccessMsg"] = categoryService.message;
                    return(RedirectToAction("CategoryList", "Category", new { pageNumber = pageNumber }));
                }
                else
                {
                    TempData["ErrorMsg"] = categoryService.message;
                }
            }
            return(View(model));
        }