having
public ActionResult Create(CategoryViewModel viewModel)
{
if (!ModelState.IsValid)
{
return View(viewModel);
}
Category category = new Category();
category.Parent = daoTemplate.FindByID<Category>(viewModel.ParentId);
category.CopyFrom(viewModel);
daoTemplate.Save(category);
return RedirectToAction("Index");
}
I need to ensure that newly created category has correct parent set. How can I do this, if I have no access to the category object outside of the method?