@NonNull
  public static Tweet tweetFromCursor(Cursor cursor) {
    Tweet tweet =
        new Tweet(
            cursor.getString(cursor.getColumnIndex(KEY_TWEET_TEXT)),
            cursor.getDouble(cursor.getColumnIndex(KEY_TWEET_LATITUDE)),
            cursor.getDouble(cursor.getColumnIndex(KEY_TWEET_LONGITUDE)),
            cursor.getString(cursor.getColumnIndex(KEY_TWEET_IMAGE_URL)));

    tweet.setId(cursor.getLong(cursor.getColumnIndex(KEY_TWEET_ID)));

    long creationDate = cursor.getLong(cursor.getColumnIndex(KEY_TWEET_CREATION_DATE));
    tweet.setCreationDate(DBHelper.convertLongToDate(creationDate));

    long modificationDate = cursor.getLong(cursor.getColumnIndex(KEY_TWEET_MODIFICATION_DATE));
    tweet.setModificationDate(DBHelper.convertLongToDate(modificationDate));

    return tweet;
  }
  public static ContentValues getContentValues(Tweet tweet) {

    if (tweet.getCreationDate() == null) {
      tweet.setCreationDate(new Date());
    }

    if (tweet.getModificationDate() == null) {
      tweet.setModificationDate(new Date());
    }

    ContentValues content = new ContentValues();
    content.put(KEY_TWEET_TEXT, tweet.getText());
    content.put(KEY_TWEET_CREATION_DATE, DBHelper.convertDateToLong(tweet.getCreationDate()));
    content.put(
        KEY_TWEET_MODIFICATION_DATE, DBHelper.convertDateToLong(tweet.getModificationDate()));
    content.put(KEY_TWEET_IMAGE_URL, tweet.getImageURL());
    content.put(KEY_TWEET_LATITUDE, String.format("%f", tweet.getLatitude()));
    content.put(KEY_TWEET_LONGITUDE, String.format("%f", tweet.getLongitude()));

    return content;
  }