Implemented general function to get event by attribute