public int GetMaxItemId() { var resolver = GetMinMaxItemRecordResolver(); var query = new TableQuery(); var task = _adapter.GetAll(_minMaxRecordTableName, query, resolver); task.Wait(); if (task.Result != null) { var records = task.Result; if (records.Any()) { return(records.Max(r => r.MaxItemId)); } } return(0); }