@Kroll.method
 public void appendItems(Object data) {
   if (TiApplication.isUIThread()) {
     handleAppendItems(data);
   } else {
     TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_APPEND_ITEMS), data);
   }
 }
  @Override
  public boolean handleMessage(Message msg) {
    switch (msg.what) {
      case MSG_SET_ITEMS:
        {
          AsyncResult result = (AsyncResult) msg.obj;
          handleSetItems(result.getArg());
          result.setResult(null);
          return true;
        }

      case MSG_GET_ITEMS:
        {
          AsyncResult result = (AsyncResult) msg.obj;
          result.setResult(itemProperties.toArray());
          return true;
        }

      case MSG_APPEND_ITEMS:
        {
          AsyncResult result = (AsyncResult) msg.obj;
          handleAppendItems(result.getArg());
          result.setResult(null);
          return true;
        }

      case MSG_INSERT_ITEMS_AT:
        {
          AsyncResult result = (AsyncResult) msg.obj;
          KrollDict data = (KrollDict) result.getArg();
          int index = data.getInt(TiC.EVENT_PROPERTY_INDEX);
          handleInsertItemsAt(index, data.get(TiC.PROPERTY_DATA));
          result.setResult(null);
          return true;
        }

      case MSG_DELETE_ITEMS_AT:
        {
          AsyncResult result = (AsyncResult) msg.obj;
          KrollDict data = (KrollDict) result.getArg();
          int index = data.getInt(TiC.EVENT_PROPERTY_INDEX);
          int count = data.getInt(TiC.PROPERTY_COUNT);
          handleDeleteItemsAt(index, count);
          result.setResult(null);
          return true;
        }

      case MSG_REPLACE_ITEMS_AT:
        {
          AsyncResult result = (AsyncResult) msg.obj;
          KrollDict data = (KrollDict) result.getArg();
          int index = data.getInt(TiC.EVENT_PROPERTY_INDEX);
          int count = data.getInt(TiC.PROPERTY_COUNT);
          handleReplaceItemsAt(index, count, data.get(TiC.PROPERTY_DATA));
          result.setResult(null);
          return true;
        }

      case MSG_GET_ITEM_AT:
        {
          AsyncResult result = (AsyncResult) msg.obj;
          KrollDict item = handleGetItemAt(TiConvert.toInt(result.getArg()));
          result.setResult(item);
          return true;
        }

      case MSG_UPDATE_ITEM_AT:
        {
          AsyncResult result = (AsyncResult) msg.obj;
          KrollDict data = (KrollDict) result.getArg();
          int index = data.getInt(TiC.EVENT_PROPERTY_INDEX);
          handleUpdateItemAt(index, data.get(TiC.PROPERTY_DATA));
          result.setResult(null);
          return true;
        }

      default:
        {
          return super.handleMessage(msg);
        }
    }
  }