implemented save method