private void UploadPhoto(UploadModel model)
 {
     var photo = new Photo
     {
         Description = model.Description,
         Filename = PhotoService.SavePhoto(model.Photo),
         UserID = WebSecurity.CurrentUserId
     };
     if (model.Tags != null)
     {
         SetTags(model.Tags, photo);
     }
     unitOfWork.PhotoRepository.Insert(photo);
     unitOfWork.Save();
 }
 public ActionResult Upload(UploadModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             UploadPhoto(model);
             return RedirectToAction("Photos", "PhotoBook", new { id = WebSecurity.CurrentUserId});
         }
     }
     catch (DataException)
     {
         ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator.");
     }
     return View(model);
 }