             ControlServer.sharedControlServer.getMeasurementHistory({ historyItems in
                 self.insertOrUpdateHistoryItems(historyItems)
 
-                success(response: historyItems)
+                if let dbHistoryItems = self.getHistoryItems(filters) {
+                    success(response: dbHistoryItems)
+                } else {
+                    success(response: historyItems)
+                }
+                
             }, error: failure)
         }
-    }
-
-    ///
-    public func getHistoryList(filters: [[String: String]], success: (response: [HistoryItem]) -> (), error failure: ErrorCallback) {
-
     }
 
     ///

        
        return nil
    }
    
    ///
    private func getHistoryItems(filters: [String]) -> [HistoryItem]? {
        if let realm = try? Realm() {
            let query = realm.objects(StoredHistoryItem.self).filter("")
                
                .sorted("timestamp", ascending: false)
            
            return query.flatMap({ storedItem in
                logger.debug("\(storedItem.model)")
                logger.debug("\(storedItem.networkType)")
                
                return Mapper<HistoryItem>().map(storedItem.jsonData)
            })
        }
        
        return nil
    }

    ///
    private func getHistoryItemUuidList() -> [String]? {


            logger.debug("distinct network types: \(distinctNetworkTypes)")
            logger.debug("distinct models: \(distinctModels)")
            
            logger.debug("COUNT1: \(realm.objects(StoredHistoryItem.self).filter("model IN %@", distinctModels).count)")
            logger.debug("COUNT2: \(realm.objects(StoredHistoryItem.self).filter("model IN %@", [distinctModels.first!]).count)")
            logger.debug("COUNT3: \(realm.objects(StoredHistoryItem.self).filter("model IN %@", [distinctModels.last!]).count)")
        }
    }
    
