public async Task<ActionResult> SaveAssignment(AssignmentDetailsViewModel model)
 {
     if (model.CategoryIds.Count == 0)
     {
         ModelState.AddModelError("CategoryIds", "You must select at least one Category for this Assignment.");
         return BadRequest(ModelState);
     }
     else
     {
         if (string.IsNullOrEmpty(model.Id))
         {
             var assignment = model.CloneToAssignment();
             assignment.CreatedBy = _userContext.UserId;
             await _assignmentManager.InsertAssignmentAsync(assignment, model.CategoryIds, model.ConnectionGroupIds);
             model.Id = assignment.Id;
             model.CreatedUTC = assignment.CreatedUTC;
         }
         else
         {
             var assignment = model.CloneToAssignment();
             await _assignmentManager.UpdateAssignmentAsync(assignment, model.CategoryIds, model.ConnectionGroupIds);
         }
         return Ok(model);
     }
 }