Remove code duplication when checking ADD_EDGE/DEL_EDGE messages.