     }
 }
 
-// MARK: - Collection
-
-extension GATTDatabase: Collection {
-    
-    public func index(after index: Int) -> Int {
-        
-        return index + 1
-    }
-    
-    public var startIndex: Int {
-        
-        return 0
-    }
-    
-    public var endIndex: Int {
-        
-        return count
-    }
-}
-
-// MARK: - RandomAccessCollection
-
-extension GATTDatabase: RandomAccessCollection {
-    
-    public subscript(bounds: Range<Int>) -> Slice<GATTDatabase> {
-        
-        return Slice<GATTDatabase>(base: self, bounds: bounds)
-    }
+// MARK: - Sequence
+
+extension GATTDatabase: Sequence {
     
     public func makeIterator() -> IndexingIterator<GATTDatabase> {
         return IndexingIterator(_elements: self)
+    }
+}
+
+// MARK: - Collection
+
+extension GATTDatabase: Collection {
+    
+    public func index(after index: Int) -> Int {
+        
+        return index + 1
+    }
+    
+    public var startIndex: Int {
+        
+        return 0
+    }
+    
+    public var endIndex: Int {
+        
+        return count
+    }
+}
+
+// MARK: - RandomAccessCollection
+
+extension GATTDatabase: RandomAccessCollection {
+    
+    public subscript(bounds: Range<Int>) -> Slice<GATTDatabase> {
+        
+        return Slice<GATTDatabase>(base: self, bounds: bounds)
     }
 }
 

    /// The attribute at the specified index.
    public subscript(index: Int) -> Attribute {
        
        get { return attributes[index] }
    }
    
    /// The attribute with the specified handle.

        
        var attribute: Attribute {
            
            var data = Data(capacity: 3 + uuid.dataLength)
            data += properties.rawValue
            data += valueHandle.littleEndian
            data += uuid.littleEndian
            
            return Attribute(handle: handle,
                             uuid: type(of: self).uuid,
                             value: data,
                             permissions: [.read])
        }
        
