private void RemoveOldImage([Bind(Include = "FileToRemove")] ProductDetailModel productDetailModel)    //remove old image from directory
 {
     foreach (var item in productDetailModel.FileToRemove.Where(f => f != 0).ToArray())
     {
         Image image = _dbContext.Image.Find(item);
         FileMng.RemoveFile(System.Web.HttpContext.Current.Server.MapPath("~\\" + image.path));
     }
 }
 public void ChangeImageIcon([Bind(Include = "IconID, IconPath, IconFile")] ProductDetailModel productDetailModel)
 {
     FileMng.RemoveFile(System.Web.HttpContext.Current.Server.MapPath("~\\" + productDetailModel.IconPath));
     ChangeIconAndDirectoryPath(productDetailModel);   //update the icon inside the directory and its path to the database
 }