Implemented save / restore of $scope attributes.