public ActionResult Delete(int id) { Document doc = _reader.GetDocument(id); if (doc == null) { throw new FpmException("Content item could not be deleted with id " + id); } if (UserDetails.CurrentUser().HasWritePermissionsToProfile(doc.ProfileId)) { _writer.DeleteDocument(doc); return(new JsonResult { Data = "Success", JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } throw new FpmException("User does not have the right to delete document " + id); }