public ActionResult Create(MediaItem model, HttpPostedFileBase file)
        {
            try
            {
                var mediaItem = new MediaItem
                {
                    Text = model.Text == null ? "" : HttpUtility.HtmlDecode(model.Text),
                    VideoSrc = model.VideoSrc
                };

                if (file != null)
                {
                    string fileName = IOHelper.GetUniqueFileName("~/Content/Images", file.FileName);
                    string filePath = Server.MapPath("~/Content/Images");
                    filePath = Path.Combine(filePath, fileName);
                    //file.SaveAs(filePath);
                    GraphicsHelper.SaveOriginalImageWithDefinedDimentions(filePath, fileName, file, 556, 0, ScaleMode.FixedWidth);
                    mediaItem.ImageSrc = fileName;
                }

                _context.MediaItems.Add(mediaItem);
                _context.SaveChanges();

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
        public ActionResult Edit(int id, MediaItem model, HttpPostedFileBase file)
        {
            try
            {
                var contentItem = _context.MediaItems.First(p => p.Id == id);
                contentItem.VideoSrc = model.VideoSrc;


                contentItem.Text = model.Text == null ? "" : HttpUtility.HtmlDecode(model.Text);

                if (file != null)
                {
                    if (!string.IsNullOrEmpty(contentItem.ImageSrc))
                    {
                        ImageHelper.DeleteImage(contentItem.ImageSrc);
                    }

                    string fileName = IOHelper.GetUniqueFileName("~/Content/Images", file.FileName);
                    string filePath = Server.MapPath("~/Content/Images");
                    filePath = Path.Combine(filePath, fileName);
                    //file.SaveAs(filePath);
                    GraphicsHelper.SaveOriginalImageWithDefinedDimentions(filePath, fileName, file, 556, 0,
                        ScaleMode.FixedWidth);
                    contentItem.ImageSrc = fileName;

                }

                _context.SaveChanges();

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }