public IEnumerable <FavouriteDTO> GetByUser(int userId) { IEnumerable <Favourite> MyFavourites = IFavouriteRepository.GetByUser(userId); List <FavouriteDTO> FavouritesDTO = new List <FavouriteDTO>(); foreach (Favourite f in MyFavourites) { FavouriteDTO favouriteDTO = new FavouriteDTO() { userId = f.userId, propertyId = f.propertyId, }; FavouritesDTO.Add(favouriteDTO); } foreach (FavouriteDTO fav in FavouritesDTO) { Property Property = IPropertyRepository.Get(fav.propertyId); fav.propertyName = Property.name; } return(FavouritesDTO); }