List <Dog> loadDogsForPage(int pageIndex) { if (ArrayUtil.InRange(pagesInitializedCheck, pageIndex)) { int dogsOnPage = getDogsOnPage(pageIndex); int startIndex = getStartIndex(pageIndex); List <DogDescriptor> dogInfos = database.GetDogRangeList(startIndex, dogsOnPage); List <Dog> matchingDogs = new DogFactory(hideGameObjects: true).CreateGroupList(dogInfos); ListUtil.CopyRange(dogCollection, matchingDogs, 0, startIndex, dogsOnPage); pagesInitializedCheck[pageIndex] = true; return(matchingDogs); } else { return(new List <Dog>()); } }