public Task <DataStoreValue> GetRandom() { var collection = _data.ToList(); if (collection.Count == 0) { return(Task.FromResult <DataStoreValue>(null)); } var element = collection.ElementAt(_random.Next(0, collection.Count)); var values = element.ToList(); if (values.Count == 0) { return(Task.FromResult <DataStoreValue>(null)); } return(Task.FromResult(new DataStoreValue(-1, element.Key, values.ElementAt(_random.Next(0, values.Count))))); }