public async Task<ActionResult> Create(PartnershipEditViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (model.Upload != null)
                {
                    var newName = Guid.NewGuid().ToString() + ".jpg";

                    FileUploadHelper.SaveImage(model.Upload.InputStream,
                        400, 400,
                        Server.MapPath("~/Public/Partnerships/") + newName,
                        FitMode.Crop);

                    model.Partnership.LogoFileName = newName;
                }


                db.Add(model.Partnership);
                await db.SaveChangesAsync();
                return RedirectToAction("Index");
            }

            return View(model);
        }
        public async Task<ActionResult> Edit(PartnershipEditViewModel model)
        {
            if (ModelState.IsValid)
            {
                db.Update(model.Partnership);

                // Update the logo if a new one is supplied. Don't allow property value changes if
                // the logo doesn't exist.
                if (model.Upload != null)
                {
                    var logo = db.GetValueFromDb(model.Partnership, p => p.LogoFileName);

                    if (logo == null)
                    {
                        model.Partnership.LogoFileName =
                            Guid.NewGuid().ToString() + "_" + model.Upload.FileName;

                        logo = model.Partnership.LogoFileName;
                    }

                    model.Partnership.LogoFileName = logo;

                    FileUploadHelper.SaveImage(model.Upload.InputStream,
                        400, 400,
                        Server.MapPath("~/Public/Partnerships/") + logo,
                        FitMode.Crop);
                }
                else
                {
                    db.ExcludeFromUpdate(model.Partnership, p => new { p.LogoFileName });
                }

                await db.SaveChangesAsync();
                return RedirectToAction("Index");
            }
            return View(model);
        }