Handle inherited classes in models