Melatonin

Okay everyone, I have insomnia hence me being awake at 4am.. I've done quite a bit of research on melatonin and ttc. Has anyone taken melatonin while pregnant or ttc? & What dosage did you take? HELP!