I would keep this function in the events namespace as suggested by @Eric89GXL