@Override public boolean equals(Object obj) { if (obj == null) { return false; } CalendarEvent calendarEvent = null; try { calendarEvent = (CalendarEvent) obj; } catch (ClassCastException cce) { return false; } long primaryKey = calendarEvent.getPrimaryKey(); if (getPrimaryKey() == primaryKey) { return true; } else { return false; } }