Middleware for template code to write to an LRS