Fixed casting of discriminatorKey defined Models