This seems like an anti-pattern to me. Any time I see branching logic based on types I throw up a red flag.