/// <summary>
        /// Get a list of all users and their ratings on every article
        /// </summary>
        public UserMenuRatingsTable GetUserMenuRatingsTable(IRater rater)
        {
            UserMenuRatingsTable table = new UserMenuRatingsTable();

            table.UserIndexToId = db.Users.OrderBy(x => x.Id).Select(x => x.Id).Distinct().ToList();
            table.MenuIndexToId = db.Menus.OrderBy(x => x.Id).Select(x => x.Id).Distinct().ToList();

            foreach (int userId in table.UserIndexToId)
            {
                table.UserMenuRatings.Add(new UserMenuRatings(userId, table.MenuIndexToId.Count));
            }

            var userArticleRatingGroup = db.UserActions
                                         .GroupBy(x => new { x.UserId, x.MenuId })
                                         .Select(g => new { g.Key.UserId, g.Key.MenuId, Rating = rater.GetRating(g.ToList()) })
                                         .ToList();

            foreach (var userAction in userArticleRatingGroup)
            {
                int userIndex    = table.UserIndexToId.IndexOf(userAction.UserId);
                int articleIndex = table.MenuIndexToId.IndexOf(userAction.MenuId);

                table.UserMenuRatings[userIndex].MenuRatings[articleIndex] = userAction.Rating;
            }

            return(table);
        }
        public void Train(UserBehavior db)
        {
            UserBehaviorTransformer ubt = new UserBehaviorTransformer(db);

            ratings = ubt.GetUserMenuRatingsTable(rater);

            List <MenuCategoryCounts> menuCategories = ubt.GetMenuCategoryCounts();

            ratings.AppendMenuFeatures(menuCategories);

            FillTransposedRatings();
        }