public void DeleteFactionByID(int id)
        {
            var factionToRemove = _entities.factions.FirstOrDefault(x => x.pk_id == id);

            if (factionToRemove == null)
            {
                throw FactionNotFoundException.FromId(id);
            }

            _entities.factions.Remove(factionToRemove);
            _entities.SaveChanges();
        }
        public void AddGuild(GuildModelDto dto)
        {
            if (_entities.guilds.FirstOrDefault(x => x.name.Equals(dto.Name)) != null)
            {
                throw new GuildAlreadyExistsException();
            }
            if (_entities.factions.FirstOrDefault(x => x.pk_id == dto.FactionId) == null)
            {
                throw FactionNotFoundException.FromId(dto.FactionId);
            }

            _entities.guilds.Add(dto.ToDbObject());
            _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();
        }