return SmartLight(id: id, name: name); --- This is poor code naming. you should use naming like this. if user provides id and name: user_provided_id, user_provided_name So I know the relationship.