added onsaving mathod for domain model