public async Task <IEnumerable <SearchProfile> > SearchForProfiles(string profileId) { var profile = await GetProfile(profileId); var categories = profile.SearchForCategory == (int)SearchCategory.Both ? new int[] { (int)SearchCategory.Men, (int)SearchCategory.Women } : new int[] { profile.SearchForCategory }; var searchResults = await _profilesRepository.SearchForProfiles(profileId, profile.SearchMinAge, profile.SearchMaxAge, categories); var profiles = searchResults.Select(ProfileMapper.ToSearchProfileContract); return(profiles); }