I've being trying this all night through. Is there any good solution to do this? Having a sample code is better!