public void DeleteRaceByID(int id)
        {
            var raceToRemove = _entities.races.FirstOrDefault(x => x.pk_id == id);

            if (raceToRemove == null)
            {
                throw RaceNotFoundException.FromId(id);
            }

            _entities.races.Remove(raceToRemove);
            _entities.SaveChanges();
        }
        public void DeleteRaceByName(string raceName)
        {
            var raceToRemove = _entities.races.FirstOrDefault(x => x.name.Equals(raceName));

            if (raceToRemove == null)
            {
                throw RaceNotFoundException.FromName(raceName);
            }

            _entities.races.Remove(raceToRemove);
            _entities.SaveChanges();
        }
        public void AddPlayer(PlayerModelDto dto, int userId)
        {
            if (_entities.classes.FirstOrDefault(x => x.pk_id == dto.ClassId) == null)
            {
                throw ClassNotFoundException.FromId(dto.ClassId);
            }
            if (_entities.factions.FirstOrDefault(x => x.pk_id == dto.FactionId) == null)
            {
                throw FactionNotFoundException.FromId(dto.FactionId);
            }
            if (_entities.races.FirstOrDefault(x => x.pk_id == dto.RaceId) == null)
            {
                throw RaceNotFoundException.FromId(dto.RaceId);
            }
            if (_entities.players.FirstOrDefault(x => x.name.Equals(dto.Name)) != null)
            {
                throw new PlayerAlreadyExistsException();
            }

            _entities.players.Add(dto.ToDbObject(userId));
            _entities.SaveChanges();
        }