What is the best way to implement such functionality?
You’ll have to be much more specific about what you’re working on.