public bool AddPlayerToGroup(int groupid, string username) { AccountContext accountContext = new AccountContext(); Player existingPlayer = accountContext.GetPlayerByUsername(username); if (existingPlayer != null && !context.IsPlayerInGroup(existingPlayer.ID, groupid)) { context.AddPlayer(groupid, existingPlayer.ID); return(true); } return(false); }