Sleep hygiene. Primary treatment of insomnia is good sleep hygiene. Get comfortable bed in quiet location without interference or distractions. Go to bed only when tired. Use bed only for sleeping and sex - not reading or watching tv. Exercise regularly - esp. Am. Limit exciting activities, stimulants and eating just before bed time. After ensuring these are done then melatonin is reasonable.
I've had insomnia/difficulty sleeping since I was a child. I take melatonin now, but other meds are always my last resort. What else should I try?
Sleep hygiene. Also practice good sleep hygiene. Avoid the use of smartphones, other bright screens before bedtime. Keep television out of the room. Limit caffeine intake.