implement save method to save entities to database.