public UserWithTotal GetLargestCreditorByUserId(int id)
        {
            using (var context = new TILDEDataContext())
            {
                UserWithTotal res = null;

                var user = context.Users.First(f => f.Id == id);

                //User creditors it is place where he is borrower(money taker)
                var borrowerAmSumm = (from b in user.Borrowers
                                      group b by b.Сreditor
                                          into groupB
                                          select new { Сreditor = groupB.Key, TotAm = groupB.Sum(am => am.Amount) });

                if (borrowerAmSumm.Count() != 0)
                {
                    var maxAm = borrowerAmSumm.Max(bm => bm.TotAm);
                    var maxBor = borrowerAmSumm.First(f => f.TotAm == maxAm);

                    res = new UserWithTotal()
                    {
                        User = maxBor.Сreditor,
                        Total = maxBor.TotAm
                    };
                }

                return res;
            }
        }
        public decimal GetAvarageBorrowingByUserId(int id)
        {
            using (var context = new TILDEDataContext())
            {
                decimal res = 0;
                var user = context.Users.First(f => f.Id == id);

                if (user.Borrowers.Count != 0)
                {
                    res = (decimal)user.Borrowers.Sum(b => b.Amount) / (decimal)user.Borrowers.Count;
                }

                return res;
            }
        }