public DbError UpdateUserTournamentPermission(UserModel user, TournamentModel tournament, Permission permission)
        {
            UserInTournamentModel uitm = new UserInTournamentModel();

            try
            {
                uitm            = context.UsersInTournaments.Where(x => x.TournamentID == tournament.TournamentID && x.UserID == user.UserID).Single();
                uitm.Permission = permission;
                context.SaveChanges();
            }
            catch (Exception ex)
            {
                interfaceException = ex;
                WriteException(ex);
                return(DbError.FAILED_TO_UPDATE);
            }
            return(DbError.SUCCESS);
        }
        public DbError AddUserToTournament(UserInTournamentModel user)
        {
            try
            {
                context.UsersInTournaments.Add(new UserInTournamentModel()
                {
                    TournamentID = user.TournamentID, UserID = user.UserID, Permission = user.Permission
                });
                context.SaveChanges();
            }
            catch (Exception ex)
            {
                interfaceException = ex;
                WriteException(ex);
                return(DbError.FAILED_TO_ADD);

                throw;
            }
            return(DbError.SUCCESS);
        }