public ActionResult Create([Bind(Include = "ModuleID,Name,CategoryId,Description,DefaultNumAnswers,DefaultTime,DefaultNumQuestions,isPrivate")] Module module) { if (ModelState.IsValid) { //**********NOTE****************// //Make sure that a user is logged in to access this page if (((User.IsInRole("Learner")) || (User.IsInRole("Admin")))) { var userID = User.Identity.GetUserId(); ApplicationUser currentUser = db.Users.Single(x => x.Id == userID); module.User = currentUser; } using (Repos repo = new Repos()) { if (!repo.AddModule(module)) { //ERROR SAVING TO DATABASE } } PopulateCategoryDropDownList(module.CategoryId); return(RedirectToAction("Index", "Profile")); } return(View(module)); }