implemented save operation