@SuppressWarnings({ "unchecked", "unused" })
   @ApiMethod(name = "listDeviceInfo")
   public CollectionResponse<DeviceInfo> listDeviceInfo(
         @Nullable @Named("cursor") String cursorString,
         @Nullable @Named("limit") Integer limit) {

      EntityManager mgr = null;
      Cursor cursor = null;
      List<DeviceInfo> execute = null;

      try {
         mgr = getEntityManager();
         Query query = mgr.createQuery("select from DeviceInfo as DeviceInfo");
         if (cursorString != null && cursorString != "") {
            cursor = Cursor.fromWebSafeString(cursorString);
            query.setHint(JPACursorHelper.CURSOR_HINT, cursor);
         }

         if (limit != null) {
            query.setFirstResult(0);
            query.setMaxResults(limit);
         }

         execute = (List<DeviceInfo>) query.getResultList();
         cursor = JPACursorHelper.getCursor(execute);
         if (cursor != null)
            cursorString = cursor.toWebSafeString();

         // Tight loop for fetching all entities from datastore and accomodate
         // for lazy fetch.
         for (DeviceInfo obj : execute)
            ;
      } finally {
         mgr.close();
      }

      return CollectionResponse.<DeviceInfo> builder().setItems(execute)
            .setNextPageToken(cursorString).build();
   }