Moved some common code to the action helper