First rough implementation of reactions

Have ported the core of reactions from boxes-core to work inside a
transaction. Note that there is not quite as much information available
to reactions yet - this will need to be added before complex reaction
implementations like Path can be ported, however it seems to work
reasonably well - needs some tests.