 let GZImageLayoutViewMetaDataImagesKey = "GZImageLayoutViewMetaDataImagesKey"
 
 
+struct GZScrollViewMetaData {
+    
+    var contentSize:CGSize
+    var contentOffset:CGPoint
+    var zoomScale:CGFloat
+    
+    init(scrollView:UIScrollView){
+        self.contentSize = scrollView.contentSize
+        self.contentOffset = scrollView.contentOffset
+        self.zoomScale = scrollView.zoomScale
+    }
+    
+}
+
+struct GZPositionViewImageMetaData{
+    var identifier:String
+    var image:UIImage!
+}
+
+struct GZPositionViewMetaData : Equatable {
+    
+    var imageMetaData:GZPositionViewImageMetaData
+    var scrollViewMetaData:GZScrollViewMetaData
+    
+    var identifier:String{
+        return self.imageMetaData.identifier
+    }
+    
+    var image:UIImage{
+        return self.imageMetaData.image
+    }
+    
+    var contentSize:CGSize{
+        return self.scrollViewMetaData.contentSize
+    }
+    
+    var contentOffset:CGPoint{
+        return self.scrollViewMetaData.contentOffset
+    }
+    
+    var zoomScale:CGFloat{
+        return self.scrollViewMetaData.zoomScale
+    }
+    
+}
+
+func ==(lhs: GZPositionViewMetaData, rhs: GZPositionViewMetaData) -> Bool{
+    return (lhs.identifier == rhs.identifier) && lhs.image.isEqual(rhs.image)
+}
+
 struct GZLayoutViewImagesMetaData {
     
-    private var content:[String:UIImage]
+    let positionMetaDatas:[GZPositionViewMetaData]
+    
+    private var content:[String:UIImage]{
+        
+        var content:[String:UIImage] = [:]
+        for positionMetaData in self.positionMetaDatas{
+            content[positionMetaData.identifier] = positionMetaData.image
+        }
+        
+        return content
+    }
     
     var numberOfImages:Int{
-        return self.content.count
+        return self.positionMetaDatas.count
     }
     
     var identifiers:[String]{
-        return content.keys.array
+        return self.positionMetaDatas.map { return $0.identifier }
     }
     
     func image(forPosition identifier:String)->UIImage!{
-        return self.content[identifier]
+        
+        if let index = find(self.identifiers, identifier) {
+            
+            var positionMetaData = self.positionMetaDatas[index]
+            return positionMetaData.image
+            
+        }
+        
+        return nil
     }
     
     func isExist(forPosition identifier:String)->Bool{
-        return self.content[identifier] != nil
-    }
-    
-
+        return find(self.identifiers, identifier) != nil
+    }
+    
+
+    init(positionViews:[String:GZPositionEditView]){
+        
+        var positionMetaDatas:[GZPositionViewMetaData] = []
+        
+        for (identifier, positionView) in positionViews {
+            positionMetaDatas.append(positionView.metaData)
+        }
+        
+        self.positionMetaDatas = positionMetaDatas
+        
+    }
+    
 }
 
 struct GZLayoutViewMetaData{
     
-    private var content:[NSObject:AnyObject]
-    
-    var layout:GZLayout{
-        return self.content[GZImageLayoutViewMetaDataLayoutKey] as GZLayout
-    }
-    
-    var imagesMetaData:GZLayoutViewImagesMetaData{
-        var metaDataContent = self.content[GZImageLayoutViewMetaDataImagesKey] as [String:UIImage]
-        return GZLayoutViewImagesMetaData(content: metaDataContent)
-    }
+//    private var content:[NSObject:AnyObject]
+    
+    var layout:GZLayout
+    let imagesMetaData:GZLayoutViewImagesMetaData
     
     var numerOfPositions:Int{
-        return self.layout.positions.count
+        return self.imagesMetaData.numberOfImages
+    }
+    
+    
+    private init(layoutView:GZImageLayoutView){
+        
+        self.imagesMetaData = GZLayoutViewImagesMetaData(positionViews: layoutView.positionViews)
+        self.layout = layoutView.layout
+        
+        
     }
     
 }

    
}

class GZPositionEditView:GZPositionView, UIScrollViewDelegate {
    
    var image:UIImage?{
        
        set{
            self.imageView.image = newValue
            
            
            if let parentLayoutView = self.layoutView {
                
                var imageMetaData = parentLayoutView.privateObjectInfo.imageMetaData
                
                if let newImage = newValue {
                    imageMetaData[self.identifier] = newImage
                }else{
                    imageMetaData.removeValueForKey(self.identifier)
                }
                
                parentLayoutView.privateObjectInfo.imageMetaData = imageMetaData
                
            }
            
        }
        
        get{

        }
    }
    
    var positionViews:[String:GZPositionEditView] = [:]
    
    var cameraView:GZCameraView{
        return self.highlighView.cameraView
