public static void addUserByArtist(
      StoreHelper storeHelper,
      DeezerClient dzClient,
      User user,
      Collection<String> favIds,
      int level)
      throws JMIException, JsonProcessingException, IOException {

    // Add the user given in paramaters to the map entities list
    if (storeHelper.getEntity(user.id) != null) {
      LOG.debug("user {} was already added, skipping...", user);
      return;
    }
    LOG.info("Add user {} to the entities list", user);
    Entity ent = storeHelper.addEntity(user.id);
    ent.addProperty("name", user.name);
    ent.addProperty("url", user.link);

    // Get user favorite albums
    Collection<Artist> favArtists =
        dzClient.getUserFavoriteArtists(user.id, new NameValuePair("nb_items", "10"));

    // Iterate through artits and add them as user attributes.
    for (Artist favArtist : favArtists) {
      Attribute att = storeHelper.getAttribute(favArtist.id);
      // If the album was not already stored as attribute create it
      // And go through this album fans
      if (att == null) {
        att = storeHelper.addAttribute(favArtist.id);
        att.addProperty("name", favArtist.name);
        att.addProperty("image", favArtist.picture);
        att.addProperty("url", favArtist.link);

        // If this artist is in my favorite list set infavlist to true otherwise to false
        // It is usefull for the menu item state at the map initialization
        att.addProperty("infavlist", favIds.contains(favArtist.id));

        if (level > 0) {
          // For each album get a list of fans
          Collection<User> fans =
              dzClient.getArtistFans(favArtist.id, new NameValuePair("nb_items", "50"));
          for (User fan : fans) {
            addUserByArtist(storeHelper, dzClient, fan, favIds, level - 1);
          }
        }
      }
      ent.addAttribute(att, 1);
    }
  }
  public static void addRelatedArtists(
      StoreHelper storeHelper,
      DeezerClient dzClient,
      Artist artist,
      Collection<String> favIds,
      int level)
      throws JsonProcessingException, JMIException, IOException {
    /*
    if(storeHelper.getEntity(artist.id) != null) {
    	LOG.debug("Artist {} was already added, skipping...", artist);
    	return;
    }
    */

    LOG.info("Add Artist {} to the attributes list", artist);
    Attribute att = storeHelper.addAttribute(artist.id);
    att.addProperty("name", artist.name);
    att.addProperty("image", artist.picture);
    att.addProperty("url", artist.link);
    att.addProperty("infavlist", favIds.contains(artist.id));

    // Ask for this artist related artists
    Collection<Artist> relatedArtists =
        dzClient.getRelatedArtists(artist.id, new NameValuePair("nb_items", "20"));

    // Iterate through related artists and add them as the artist entities.
    for (Artist relatedArtist : relatedArtists) {
      Entity ent = storeHelper.getEntity(relatedArtist.id);

      // If the artist was not already stored as entity create it
      if (ent == null) {
        ent = storeHelper.addEntity(relatedArtist.id);
        ent.addProperty("name", relatedArtist.name);
        ent.addProperty("image", relatedArtist.picture);
        ent.addProperty("url", relatedArtist.link);

        // If this artist is in my favorite list set infavlist to true otherwise to false
        // It is usefull for the menu item state at the map initialization phase
        ent.addProperty("infavlist", favIds.contains(relatedArtist.id));

        if (level > 0) {
          // Call that function again for that related artist
          addRelatedArtists(storeHelper, dzClient, relatedArtist, favIds, level - 1);
        }
      }
      ent.addAttribute(att, 1);
    }
  }