This fixes a potential crash where a user could provide duplicate trigger names to this code and it would attempt to write the same chain twice.
@jcatmore, @elmsheus