This article discusses REM sleep behavior disorder (RBD). It's a type of sleepwalking disorder, most commonly seen in older men with neurodegenerative disorders like Parkinsons Disease. It's not curable, but can be treated. Sometimes, untreated obstructive sleep apnea drives the RBD. Certain medications, like antidepressants, can worsen RBD. I sometimes use Klonopin, but have used melatonin or a medicine for Restless legs syndrome.
The study compared melatonin and klonopin, and both seemed to be effective. Patients stopped the medications at about the same rate, but for different reasons - melatonin for lack of efficacy and klonopin for side effects.
For some patients, medications just do not help. It's important to make sure the bedroom environment is safe. Some patients need bed rails to prevent falling out of bed. I have even had some patients sleep in a sleeping bag so they wont be able to move that much! It works like swaddling a baby helps keep the baby from moving around in a crib.