Avoid repeated SQL lookups for current_state whilst looping through each possible event