public void InsertOrUpdate(UsersInTask usersintask)
 {
     if (usersintask.UsersInTaskId == default(long)) {
         // New entity
         context.UsersInTask.Add(usersintask);
     } else {
         // Existing entity
         context.Entry(usersintask).State = EntityState.Modified;
     }
 }
 public ActionResult Create(UsersInTask usersintask)
 {
     if (ModelState.IsValid) {
         usersintaskRepository.InsertOrUpdate(usersintask);
         usersintaskRepository.Save();
         return RedirectToAction("Index");
     } else {
         ViewBag.PossibleTask = taskRepository.All;
         ViewBag.PossibleUser = userRepository.All;
         return View();
     }
 }