public ActionResult Create(File file, HttpPostedFileBase upload)
        {
            if (upload != null && upload.ContentLength > 0)
            {
                var userInfo = db.UserInfos.Find(Membership.GetUser().ProviderUserKey);
                file.User = userInfo;
                file.FileId = Guid.NewGuid();
                file.Deleted = false;
                file.FilePath = file.FileId.ToString() + "_" + Guid.NewGuid().ToString();
                file.NbOfDownloads = 0;
                file.UploadDate = DateTime.Now;
                file.FileSizeBytes = upload.ContentLength;
                file.FileExtension = upload.FileName.Split('.').Last();
                file.OriginalFileName = upload.FileName;

                if (ModelState.IsValid)
                {
                    AzureHelper.WriteBlobFromStream(file.FilePath, upload.InputStream);

                    db.Files.Add(file);
                    db.SaveChanges();
                    return RedirectToAction("Index", "Account");
                }
            }
            return View(file);
        }
        public ActionResult Edit(File file, HttpPostedFileBase upload)
        {
            var dbFile = db.Files.Include("User").Where(f => f.FileId == file.FileId).FirstOrDefault();
            if (dbFile == null || dbFile.User == null || dbFile.User.UserInfoId != (Guid)Membership.GetUser().ProviderUserKey)
            {
                return HttpNotFound();
            }
            if (ModelState.IsValid)
            {

                if (upload != null && upload.ContentLength > 0)
                {
                    dbFile.FileSizeBytes = upload.ContentLength;
                    dbFile.FileExtension = upload.FileName.Split('.').Last();
                    dbFile.OriginalFileName = upload.FileName;

                    AzureHelper.WriteBlobFromStream(dbFile.FilePath, upload.InputStream);
                }

                dbFile.Title = file.Title;
                dbFile.Description = file.Description;
                dbFile.DownloadPrice = file.DownloadPrice;

                db.SaveChanges();
                return RedirectToAction("Index", "Account");
            }
            return View(file);
        }