public IEnumerable <Balance> GetBalancesOnDate(DateTime onDate, int[] productIds)
        {
            var multiQuery = CurrentSession.CreateMultiQuery();

            foreach (int id in productIds)
            {
                multiQuery.Add <Balance>(
                    CurrentSession.CreateQuery(@"
                        from Balance 
                        where Date = (select max(b.Date) from Balance as b where b.Date <= :onDate and b.Product.Id = :productId)
                            and Product.Id = :productId
                    ")
                    .SetDateTime("onDate", onDate)
                    .SetInt32("productId", id)
                    );
            }
            var balancesOnDate = multiQuery.List().Cast <List <Balance> >();

            return((from balance in balancesOnDate select balance.Count == 0 ? null : balance[0]).Where(b => b != null).ToList());
        }