private Account AddAccountForCurrentAcademicYearForStuddentIfNotPresent(AcademicYear currentAcademicYear,
                                                                                Student student)
        {
            var previousAcademicYear =
                PageDataService.GetAcademicYearByStartYearAdoNet(currentAcademicYear.AcademicYearStart.Year - 1);
            var studentAccount = PageDataService.GetAccountByStudentIdAndAcademicYearIdAdoNet(student.StudentId,
                                                                                              currentAcademicYear.
                                                                                              AcademicYearId);


            if (previousAcademicYear != null && studentAccount == null)
            {
                var studentPreviousYearAccount =
                    PageDataService.GetAccountByStudentIdAndAcademicYearIdAdoNet(student.StudentId,
                                                                                 previousAcademicYear.
                                                                                 AcademicYearId);
                if (studentPreviousYearAccount != null)
                {
                    var transactionDetailListOfPreviousYear =
                        PageDataService.GetAllActiveTransactionDetailsByStudentIdByAccountIdByAcademicYearIdAdoNet(
                            student.StudentId, studentPreviousYearAccount.AccountId, previousAcademicYear.AcademicYearId);
                    if (transactionDetailListOfPreviousYear != null && transactionDetailListOfPreviousYear.Count > 0)
                    {
                        var totalAmountPaid = transactionDetailListOfPreviousYear.Aggregate(0,
                                                                                            (current, transactionDetail)
                                                                                            =>
                                                                                            current +
                                                                                            Convert.ToInt32(
                                                                                                transactionDetail.
                                                                                                AmountPaid));
                        var previousYearFee = PageDataService.GetFeeMasterByMediumIdAndClassIdAndAcademicYearIdAdoNet(
                            studentPreviousYearAccount.MediumId, studentPreviousYearAccount.ClassId,
                            previousAcademicYear.AcademicYearId);
                        var scholarShipDetailsOfPreviousYear =
                            PageDataService.GetScholarShipDetailsByStudentIdAndAcademicYearIdAdoNet(student.StudentId,
                                                                                                    previousAcademicYear.
                                                                                                    AcademicYearId);
                        var scholarShipToatlAmountSanctioned = scholarShipDetailsOfPreviousYear.Aggregate(0,
                                                                                                          (current,
                                                                                                           scholarShipDetail)
                                                                                                          =>
                                                                                                          current +
                                                                                                          Convert.
                                                                                                          ToInt32(
                                                                                                              scholarShipDetail
                                                                                                              .
                                                                                                              AmountSanctioned));

                        var carryFarwardFee = (Convert.ToInt32(studentPreviousYearAccount.CarryFarwordFee) +
                                               Convert.ToInt32(previousYearFee.Fee)) -
                                              (Convert.ToInt32(scholarShipToatlAmountSanctioned) + totalAmountPaid);


                        PageDataService.AddAcoountByStudentIdByAcademicYearIdByClassIdByMediumIdByCarryFarwordFeeAdoNet(
                            student.StudentId, currentAcademicYear.AcademicYearId, student.Class, student.MediumId,
                            Convert.ToInt32(carryFarwardFee));
                    }
                }
                else
                {
                    PageDataService.AddAcoountByStudentIdByAcademicYearIdByClassIdByMediumIdByCarryFarwordFeeAdoNet(
                        student.StudentId, currentAcademicYear.AcademicYearId, student.Class, student.MediumId, 0);
                }
            }
            else if (previousAcademicYear == null && studentAccount == null)
            {
                PageDataService.AddAcoountByStudentIdByAcademicYearIdByClassIdByMediumIdByCarryFarwordFeeAdoNet(
                    student.StudentId, currentAcademicYear.AcademicYearId, student.Class, student.MediumId, 0);
            }
            studentAccount = PageDataService.GetAccountByStudentIdAndAcademicYearIdAdoNet(student.StudentId,
                                                                                          currentAcademicYear.
                                                                                          AcademicYearId);
            return(studentAccount);
        }