Trazodone and ambien can you take both two hours apart?

Patient: I took Trazodone two hours ago to help me sleep but it is not helping. I took one pill 50 mg. Can I still take a ambien to help me sleep?

Doctor: