Fixed a bunch of foreign keys left over from entity framework
Added some exception handing code