ForeCAT - A model for magnetic deflections of coronal mass ejections