public static bool AddParticipation(GameTable table, string curUser) { if (table.IsFull()) { return(false); } Participation newParticipation; if (table.Participations.Count % 2 == 1) { User actualUser = UserRepository.Instance.Get() .First(user => user.Value.Nickname == curUser).Value; newParticipation = new Participation(actualUser) { Partner = table.Participations.Last().Participant }; table.Participations.Last().Partner = actualUser; } else { newParticipation = new Participation(UserRepository.Instance.Get().First(user => user.Value.Nickname == curUser).Value); } table.PlayerFieldAreas.Find(area => area.Identifier == table.Participations.Count + 1).Participation = newParticipation; table.Participations.Add(newParticipation); return(true); }