/// <summary>
        /// Function to set IsSeen true for new activity after display
        /// </summary>
        /// <param name="userID">userID</param>
        public void MarkSeenRecentActivity(int userID)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var usrActRepo =
                        new UserActivityRepository(new EFRepository <UserActivity>(), unitOfWork);

                    ObjectSet <UserActivity> usrActObjSet =
                        ((CurrentDeskClientsEntities)usrActRepo.Repository.UnitOfWork.Context).UserActivities;

                    var activities = usrActObjSet.Include("L_ActivityType").Include("ProfileActivities").Include("DocumentActivities.Document").Include("AccountActivities.L_CurrencyValue").Include("TransferActivities.L_CurrencyValue").Include("ConversionActivities.L_CurrencyValue").Where(usr => usr.FK_UserID == userID).OrderByDescending(odr => odr.Timestamp).Take(15).ToList();

                    //Set IsSeen true for each activity
                    foreach (var act in activities)
                    {
                        act.IsSeen = true;
                    }

                    usrActRepo.Save();
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }
        // Add your own data access methods here.  If you wish to
        // expose your public method to a WCF service, marked them with
        // the attribute [NCPublish], and another T4 template will generate your service contract

        /// <summary>
        /// This method inserts new profile activity record in db
        /// </summary>
        /// <param name="userID">userID</param>
        /// <param name="activityType">activityType</param>
        /// <returns></returns>
        public int InsertUserActivityDetails(int userID, int activityType)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var usrActRepo =
                        new UserActivityRepository(new EFRepository <UserActivity>(), unitOfWork);

                    UserActivity newActivity = new UserActivity();
                    newActivity.FK_ActivityTypeID = activityType;
                    newActivity.FK_UserID         = userID;
                    newActivity.Timestamp         = DateTime.UtcNow;
                    newActivity.IsSeen            = false;

                    usrActRepo.Add(newActivity);
                    usrActRepo.Save();

                    return(newActivity.PK_UserActivityID);
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }
        /// <summary>
        /// This method marks IsSeen true for new recent client activity
        /// </summary>
        /// <param name="clientIds">clientIds</param>
        public void MarkSeenRecentClientActivity(string clientIds)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var usrActRepo =
                        new UserActivityRepository(new EFRepository <UserActivity>(), unitOfWork);

                    ObjectSet <UserActivity> usrActObjSet =
                        ((CurrentDeskClientsEntities)usrActRepo.Repository.UnitOfWork.Context).UserActivities;

                    var allActivities = usrActObjSet.Include("User.Clients.IndividualAccountInformations").Include("ProfileActivities").Include("DocumentActivities.Document").Include("AccountActivities.L_CurrencyValue").Include("TransferActivities.L_CurrencyValue").Include("ConversionActivities.L_CurrencyValue").Where(usr => usr.FK_ActivityTypeID != (int)ActivityType.ProfileActivity).ToList();

                    allActivities = allActivities.Where(clnt => clientIds.Contains(clnt.FK_UserID.ToString())).OrderByDescending(odr => odr.Timestamp).Take(15).ToList();

                    //Mark seen true for each recent client activity
                    foreach (var act in allActivities)
                    {
                        act.IsSeen = true;
                    }

                    //Save in db
                    usrActRepo.Save();
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }
        /// <summary>
        /// This method returns list of user activities
        /// </summary>
        /// <param name="userID">userID</param>
        /// <returns></returns>
        public List <UserActivity> GetUserRecentActivityDetails(int userID)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var usrActRepo =
                        new UserActivityRepository(new EFRepository <UserActivity>(), unitOfWork);

                    ObjectSet <UserActivity> usrActObjSet =
                        ((CurrentDeskClientsEntities)usrActRepo.Repository.UnitOfWork.Context).UserActivities;

                    return(usrActObjSet.Include("L_ActivityType").Include("ProfileActivities").Include("DocumentActivities.Document").Include("AccountActivities.L_CurrencyValue.Client_Account").Include("TransferActivities.L_CurrencyValue").Include("ConversionActivities.L_CurrencyValue").Include("DepositOrWithdrawActivities.BankAccountInformation").Include("DepositOrWithdrawActivities.L_CurrencyValue").Where(usr => usr.FK_UserID == userID).OrderByDescending(odr => odr.Timestamp).Take(15).ToList());
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }