public IEnumerable <MenuDTO> GetMenuItems() { Mapper.Initialize(o => o.CreateMap <Menu, MenuDTO>().PreserveReferences()); IEnumerable <Menu> menuList = Database.MenuItems.GetAll(); List <MenuDTO> temp = new List <MenuDTO>(); foreach (var item in menuList) { temp.Add(MyMapper.MenuToMenuDTO(item)); } return(temp); }