public async Task <List <Profile> > GetBlocks([FromBody] BuddyLookup lookupData) { var blocks = (await blockRepository.Lookup(lookupData)).ToList(); List <Profile> profiles = new List <Profile>(); for (int i = 0; i < blocks.Count; i++) { if (lookupData.reverseLookup.HasValue && lookupData.reverseLookup.Value) { profiles.Add(blocks[i].FromProfile); } else { profiles.Add(blocks[i].ToProfile); } } return(profiles); }