public Server getNetworkServerTypeServerNumber(
      Network network, ServerType serverType, int number) {
    List<Server> servers = new ArrayList<>();

    BasicDBObject query = new BasicDBObject("network_id", network.getId().toString());
    query.put("server_type_id", serverType.getId().toString());
    query.put("number", number);

    DBObject dbServer = getDatabase().findOne("servers", query);
    if (dbServer == null) {
      return null;
    }
    return getModel((ObjectId) dbServer.get("_id"), network, serverType);
  }
  public List<Server> getNetworkServers(Network network, boolean onlyActive) {

    List<Server> servers = new ArrayList<>();

    BasicDBObject query = new BasicDBObject("network_id", network.getId().toString());
    if (onlyActive == true) {
      query.put("number", new BasicDBObject("$gt", 0));
      query.put("port", new BasicDBObject("$gt", 0));
    }

    DBCursor serversCursor = getDatabase().findMany("servers", query);
    while (serversCursor.hasNext()) {
      servers.add(getModel((ObjectId) serversCursor.next().get("_id"), network));
    }

    return servers;
  }
  public int getNextNumber(Network network, ServerType serverType) {
    int number = 1;

    List<Integer> numbers = new ArrayList<>();

    BasicDBObject query = new BasicDBObject("network_id", network.getId().toString());
    query.put("server_type_id", serverType.getId().toString());

    DBCursor serversCursor = getDatabase().findMany("servers", query);
    while (serversCursor.hasNext()) {
      int serverNumber = (int) serversCursor.next().get("number");
      numbers.add(serverNumber);
    }

    while (numbers.contains(number)) {
      number += 1;
    }

    return number;
  }