/** Removes revoked and invalid photo attributes from a photo attribute array. */
 private PhotoAttribute[] filterArray(PhotoAttribute[] original) {
   List<PhotoAttribute> filtered = new ArrayList<>();
   for (PhotoAttribute att : original) {
     if (!att.isRevokedOrInvalid()) {
       filtered.add(att);
     }
   }
   return filtered.toArray(new PhotoAttribute[filtered.size()]);
 }
  /**
   * Warning: this method uses the unextended position of the cursor!
   *
   * @param cursor A cursor, already moved to the correct position.
   * @return The array of photo attributes produced from the attribute data at that cursor position.
   */
  public PhotoAttribute[] getItemArrayAtUnextendedPosition(Cursor cursor) {
    int rank = cursor.getInt(INDEX_RANK);

    PhotoAttribute[] attributes = mPhotoAttributeCache.get(rank);
    if (attributes != null) {
      Log.d(Constants.TAG, "The requested photo attribute array is cached!");
      return attributes;
    }
    Log.d(Constants.TAG, "The requested photo attribute array is not cached!");

    try {
      byte[] data = cursor.getBlob(INDEX_ATTRIBUTE_DATA);
      int status = getStatus(cursor);
      attributes = PhotoAttribute.fromAttributeData(data, status, mContext);
      if (!mShowRevokedItems) {
        attributes = filterArray(attributes);
      }
      mPhotoAttributeCache.put(rank, attributes);
      return attributes;
    } catch (IOException e) {
      Log.e(Constants.TAG, "Could not read photo attribute subpacket data", e);
      return null;
    }
  }