Adjusted class_to_db_object() logic for models to only include fields that are directly assigned (skip inherited fields from traits or parent classes)