/// <summary>
 /// Validates a team team member on the server
 /// before adding a new record.
 /// </summary>
 /// <param name="viewModel">The view model containing the values to validate.</param>
 private void ValidateTeamTeamMember(TeamTeamMembersAddViewModel viewModel)
 {
     if (viewModel.Team.TeamMembers.Count() >= viewModel.Team.Event.TeamSizeLimit)
     {
         TempData["Error"] = "This team can't have more players, it's full!";
     }
     // If there aren't any "TeamMemberId" and "RoleId" field validation errors...
     if (ModelState.IsValidField("TeamMemberId") &&
         ModelState.IsValidField("RoleId"))
     {
         // Then make sure that this team member and role combination
         // doesn't already exist for this team.
         if (_teamsRepository.TeamHasTeamMemberRoleCombination(viewModel.TeamId, viewModel.TeamMemberId, viewModel.RoleId))
         {
             ModelState.AddModelError("TeamMemberId",
                                      "This team member and role combination already exists for this team.");
         }
     }
 }