         
         attributeGroups.append(group)
         
-        return attributeGroups.endIndex
+        return serviceAttribute.handle
     }
     
     /// Clear the database.

    
    // MARK: - Methods
    
    public mutating func add(service: Service) -> Int {
        
        let serviceAttribute = Attribute(service: service, handle: newHandle())
        

    }
    
    /// Remove the Service at the specified index.
    public mutating func remove(service handle: UInt16) {
        
        guard let serviceIndex = attributeGroups.index(where: { $0.service.handle == handle })
            else { fatalError("Service with handle \(handle) doesnt exist") }
        
        attributeGroups.remove(at: serviceIndex)
    }
    
    /// Write the value to attribute specified by the handle.
