title: How to insert list of objects using ContentValues.put()?
body: <p>I am trying to insert data into the SQLite database and for that I have written a simple method to insert the data that I get from the API as shown below:</p>
  
  <pre><code>public static ContentValues gameInfoToContentValues(@NonNull GameInfoList game) {
  
          ContentValues values = new ContentValues();
  
          values.put(GameEntry.COLUMN_GAME_ID, game.id());
          values.put(GameEntry.COLUMN_GAME_ALIASES, game.aliases());
          values.put(GameEntry.COLUMN_GAME_API_DETAIL_URL, game.api_detail_url());
          values.put(GameEntry.COLUMN_GAME_DATE_ADDED, game.date_added());
          values.put(GameEntry.COLUMN_GAME_DATE_LAST_UPDATED, game.date_last_updated());
          values.put(GameEntry.COLUMN_GAME_SMALL_IMAGE, game.image().small_url());
          values.put(GameEntry.COLUMN_GAME_MEDIUM_IMAGE, game.image().medium_url());
          values.put(GameEntry.COLUMN_GAME_HD_IMAGE, game.image().super_url());
          values.put(GameEntry.COLUMN_GAME_NAME, game.name());
          values.put(GameEntry.COLUMN_GAME_ORIGINAL_RELEASE_DATE, game.original_game_rating());
  
          return values;
      }
  </code></pre>
  
  <p>I am getting for the last</p>
  
  <pre><code>game.original_game_rating();
  </code></pre>
  
  <p>which is correctly justified because it is a List of object.</p>
  
  <p>My object class named "GameInfoList" which is passed as the parameter in the method is shown below:</p>
  
  <pre><code>public abstract long id();
  
  @Nullable
  public abstract String aliases();
  
  @Nullable
  public abstract String api_detail_url();
  
  @Nullable
  public abstract String date_added();
  
  @Nullable
  public abstract String date_last_updated();
  
  @Nullable
  public abstract GameImages image();
  
  @Nullable
  public abstract String name();
  
  @Nullable
  public abstract List&lt;GameRatings&gt; original_game_rating();
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>I also have GameRatings object as shown below:</p>
  
  <pre><code>@Nullable
  public abstract String api_detail_url();
  
  public abstract long id();
  
  @Nullable
  public abstract String name();
  </code></pre>
  
  <p>Now I want to insert the name inside the table for game rating for which I have modified the code as below:</p>
  
  <pre><code>public static ContentValues gameInfoToContentValues(@NonNull GameInfoList game) {
  
      ContentValues values = new ContentValues();
  
      if(game.original_game_rating() != null) {
          for(GameRatings ratings : game.original_game_rating()) {
              values.put(GameEntry.COLUMN_GAME_ID, game.id());
              values.put(GameEntry.COLUMN_GAME_ALIASES, game.aliases());
              values.put(GameEntry.COLUMN_GAME_API_DETAIL_URL, game.api_detail_url());
              values.put(GameEntry.COLUMN_GAME_DATE_ADDED, game.date_added());
              values.put(GameEntry.COLUMN_GAME_DATE_LAST_UPDATED, game.date_last_updated());
              values.put(GameEntry.COLUMN_GAME_SMALL_IMAGE, game.image().small_url());
              values.put(GameEntry.COLUMN_GAME_MEDIUM_IMAGE, game.image().medium_url());
              values.put(GameEntry.COLUMN_GAME_HD_IMAGE, game.image().super_url());
              values.put(GameEntry.COLUMN_GAME_NAME, game.name());
              values.put(GameEntry.COLUMN_GAME_ORIGINAL_GAME_RATING, ratings.name());
          }
      }
  
      return values;
  }
  </code></pre>
  
  <p>Is this right?</p>