/// <summary> /// Gets the clients from Repository.Container.Database. /// </summary> /// <returns></returns> public Dictionary <uint, ClientDbEntry> GetClientsFromDatabase() { lock (Container.lockGetClientsFromDatabase) { if (!Container.ClientDatabaseList.Any()) { var response = QueryRunner.GetClientDatabaseList(0, 100, true); response.ToList().ForEach(m => { if (!Container.ClientDatabaseList.ContainsKey(m.DatabaseId)) { Container.ClientDatabaseList.Add(m.DatabaseId, m); } }); for (int i = 100; i < (response.TotalClientsInDatabase ?? uint.MaxValue); i = i + 100) { var moreResponse = QueryRunner.GetClientDatabaseList((uint)i, (uint)(i + 100), false); if (!moreResponse.Any()) { break; } moreResponse.ToList().ForEach(m => { if (!Container.ClientDatabaseList.ContainsKey(m.DatabaseId)) { Container.ClientDatabaseList.Add(m.DatabaseId, m); } }); } } return(Container.ClientDatabaseList); } }