Hi @Antoine6,
in general you’re right: A controller would be a good fit for this. Do you have some code example of your current implementation? Updating the built-in implementation that can be found in the documentation should just work fine so that’s why some code snippet would be great to check what is going wrong there 
Cheers