public void deleteMap(int position) {
    BeaconMap beaconMap = (BeaconMap) mGridView.getItemAtPosition(position);
    ParseQuery<Place> parseQueryBeacon = ParseQuery.getQuery("Place");
    parseQueryBeacon.whereEqualTo(Constants.COLUMN_PLACE_MAP_ID, beaconMap.getObjectId());

    try {

      ParseQuery<Beacon> beaconParseQuery = ParseQuery.getQuery("Beacon");
      beaconParseQuery.whereEqualTo(Constants.COLUMN_BEACON_MAP_ID, beaconMap.getObjectId());
      List<Beacon> beaconList = beaconParseQuery.find();
      for (Beacon beacon : beaconList) {
        beacon.deleteInBackground();
      }

      List<Place> placeList = parseQueryBeacon.find();
      for (Place place : placeList) {
        ParseQuery<BeaconPower> beaconPowerParseQuery = ParseQuery.getQuery("BeaconPower");
        beaconPowerParseQuery.whereEqualTo(
            Constants.COLUMN_BEACON_MEASURE_PLACE_ID, place.getObjectId());
        List<BeaconPower> beaconPowerList = beaconPowerParseQuery.find();
        for (BeaconPower beaconPower : beaconPowerList) {
          beaconPower.delete();
        }

        place.deleteInBackground();
      }
    } catch (ParseException e) {
      e.printStackTrace();
    }

    beaconMap.deleteInBackground();
  }
 private void onMapSelected(BeaconMap beaconMap) {
   Intent placeBeaconIntent = new Intent(MainActivity.this, PlaceBeaconActivity.class);
   placeBeaconIntent.putExtra("mapId", beaconMap.getObjectId());
   placeBeaconIntent.putExtra("imagePath", beaconMap.getImagePath());
   startActivity(placeBeaconIntent);
 }