@Override
 public void createOrUpdatePlayer(Player player) {
   List<Object> players = new ArrayList<>();
   player.setId(UUID.randomUUID());
   players.add(player);
   wrideNodeListToFile(players, getFile());
 }
  @Override
  public Player getPlayer() {

    Optional<NodeList> result = Optional.ofNullable(readNodeListFromFile("player"));
    if (result.isPresent()) {
      NodeList nodeList = result.get();
      Player player = new Player();
      IntStream.range(0, nodeList.getLength())
          .mapToObj(nodeList::item)
          .forEach(
              i -> {
                Element element = (Element) i;
                player.setId(UUID.fromString(element.getAttribute("id")));
                player.setPosition(
                    Position.findByValue(
                        element.getElementsByTagName("position").item(0).getTextContent()));
                player.setTeamId(
                    element.getElementsByTagName("teamId").item(0).getTextContent().isEmpty()
                        ? null
                        : Integer.valueOf(
                            element.getElementsByTagName("teamId").item(0).getTextContent()));
                player.setMatchDay(
                    Integer.valueOf(
                        element.getElementsByTagName("matchDay").item(0).getTextContent()));
                player.setExperience(
                    Integer.valueOf(
                        element.getElementsByTagName("experience").item(0).getTextContent()));
              });

      return player;
    }

    return null;
  }