public static SearchResultItem fromCursor(Cursor cursor, boolean close) {
    SearchResultItem item = new SearchResultItem();
    if (cursor.getCount() == 0) {
      return null;
    }

    if (cursor.getPosition() == -1) {
      cursor.moveToNext();
    }

    item.setBrandName(
            cursor.getString(cursor.getColumnIndex(DataContract.SearchResultEntry.BRAND_NAME)))
        .setOriginalPrice(
            cursor.getString(cursor.getColumnIndex(DataContract.SearchResultEntry.ORIGINAL_PRICE)))
        .setPrice(cursor.getString(cursor.getColumnIndex(DataContract.SearchResultEntry.PRICE)))
        .setImageUrl(
            cursor.getString(cursor.getColumnIndex(DataContract.SearchResultEntry.IMAGE_URL)))
        .setAsin(cursor.getString(cursor.getColumnIndex(DataContract.SearchResultEntry.ASIN)))
        .setProductUrl(
            cursor.getString(cursor.getColumnIndex(DataContract.SearchResultEntry.PRODUCT_URL)))
        .setProductRating(
            cursor.getFloat(cursor.getColumnIndex(DataContract.SearchResultEntry.PRODUCT_RATING)))
        .setProductName(
            cursor.getString(cursor.getColumnIndex(DataContract.SearchResultEntry.PRODUCT_NAME)));

    if (close) {
      cursor.close();
    }
    return item;
  }
 public static ContentValues toContentValues(SearchResultItem item) {
   ContentValues values = new ContentValues();
   values.put(DataContract.SearchResultEntry.BRAND_NAME, item.getBrandName());
   values.put(DataContract.SearchResultEntry.ORIGINAL_PRICE, item.getOriginalPrice());
   values.put(DataContract.SearchResultEntry.PRICE, item.getPrice());
   values.put(DataContract.SearchResultEntry.IMAGE_URL, item.getImageUrl());
   values.put(DataContract.SearchResultEntry.ASIN, item.getAsin());
   values.put(DataContract.SearchResultEntry.PRODUCT_URL, item.getProductUrl());
   values.put(DataContract.SearchResultEntry.PRODUCT_RATING, item.getProductRating());
   values.put(DataContract.SearchResultEntry.PRODUCT_NAME, item.getProductName());
   return values;
 }