Centralise ID validation and throw useful exception.

id = int(id) being used to make sure id is and int. ValueError and TypeError exceptions get thrown which aren't very helpful. ID checking has been centralised in one method and now throws an IdInvalid exception.