Diabetes may increase risk of developing dementia, study finds