Change `db` to type `*gorm.DB` to reflect latest version of gorm. Remove re-declarations of `db, err`