You might also want to use or implement something similar to…
This is very modular and additional actions can easily be added.