public ActionResult Create(ResourceViewModel viewModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var model = new Resource();
                    viewModel.MapOntoModel(ref model);
                    var newDoc = new ResourceDoc();
                    viewModel.NewDoc.MapOntoModel(ref newDoc);
                    model.ResourceDocs.Add(newDoc);
                    _resourceRepository.Add(model);
                    _resourceRepository.SaveChanges();

                    return RedirectToAction("Index");
                }
                else
                {
                    return View(viewModel);
                }
            }
            catch(Exception ex)
            {
                _logger.Error("ResourcesController.Create", ex);
                ModelState.AddModelError("", ex);
                return View(viewModel);
            }
        }
        public ActionResult Edit(ResourceViewModel viewModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var resource = _resourceRepository.GetById(viewModel.Id);
                    viewModel.MapOntoModel(ref resource);
                    _resourceRepository.Save(resource);
                    _resourceRepository.SaveChanges();

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