Change factory method to return an id instead of specific class instance.