Hi @ksingh778,
I believe this has already been addressed here:
Or at least can help accomplish your requirements.
Hope this helps!