public Boolean ManageProspectsSave(ManageProspectsViewModel manageProspectsViewModel)
        {
            var user = AccountHelper.GetUserAccount(HttpContext);

            Int32 status     = 0;
            Int32 concierge  = 0;
            Int32 callCenter = 0;
            Int32 loa        = 0;

            if (!String.IsNullOrEmpty(manageProspectsViewModel.SelectedCallCenter))
            {
                Int32.TryParse(manageProspectsViewModel.SelectedCallCenter, out callCenter);
            }

            if (!String.IsNullOrEmpty(manageProspectsViewModel.SelectedLoa))
            {
                Int32.TryParse(manageProspectsViewModel.SelectedLoa, out loa);
            }

            if (!String.IsNullOrEmpty(manageProspectsViewModel.SelectedStatus))
            {
                Int32.TryParse(manageProspectsViewModel.SelectedStatus, out status);
            }

            if (!String.IsNullOrEmpty(manageProspectsViewModel.SelectedConcierge))
            {
                Int32.TryParse(manageProspectsViewModel.SelectedConcierge, out concierge);
            }

            Guid companyId = Guid.Empty;

            if (!String.IsNullOrEmpty(manageProspectsViewModel.CompanyId))
            {
                Guid.TryParse(manageProspectsViewModel.CompanyId, out companyId);
            }

            var updated = ContactServiceFacade.UpdateContactProspect(
                manageProspectsViewModel.ProspectId, status, concierge, user.UserAccountId, companyId, manageProspectsViewModel.ChannelId, manageProspectsViewModel.DivisionId, manageProspectsViewModel.BranchId, callCenter, loa);

            if (manageProspectsViewModel.LoanId == Guid.Empty)
            {
                return(updated);
            }



            bool isSubmited = LoanServiceFacade.AssignOfficersToLoan(manageProspectsViewModel.LoanId, companyId, manageProspectsViewModel.ChannelId, manageProspectsViewModel.DivisionId, manageProspectsViewModel.BranchId, concierge, callCenter, loa);

            if (!isSubmited)
            {
                return(false);
            }

            ActivitiesServiceFacade.ExecuteActivityRulesConcierge(
                ActivitiesServiceFacade.RetrieveActivity(manageProspectsViewModel.LoanId, ActivityType.CompleteLoanApplication, user.UserAccountId).Id,
                ActivityStatus.Completed, ActivityMode.None, false, ActionIntent.LoanNoAndConciergeAssigned, user.Party.Id, user.UserAccountId);

            return(true);
        }
        public Boolean SaveAssignInfo(AssignLoanInfoViewModel assignLoanInfoViewModel)
        {
            UserAccount user = null;

            if (Session[SessionHelper.UserData] != null)
            {
                user = ( UserAccount )Session[SessionHelper.UserData];
            }
            try
            {
                var loaId       = assignLoanInfoViewModel.LoaId.HasValue ? assignLoanInfoViewModel.LoaId.Value : -1;
                var conciergeId = assignLoanInfoViewModel.ConciergeId.HasValue ? assignLoanInfoViewModel.ConciergeId.Value : -1;

                var callCenterId = assignLoanInfoViewModel.CallCenterId.HasValue ? assignLoanInfoViewModel.CallCenterId.Value : -1;

                Guid companyId = Guid.Empty;

                if (!String.IsNullOrEmpty(assignLoanInfoViewModel.CompanyId))
                {
                    Guid.TryParse(assignLoanInfoViewModel.CompanyId, out companyId);
                }

                int  loanNumber;
                bool isLoanNumberAssigned = int.TryParse(assignLoanInfoViewModel.LoanNumber, out loanNumber) && loanNumber > 0;

                if (user != null && !isLoanNumberAssigned)
                {
                    string loanNum = LoanServiceFacade.RetrieveLoanNumber(assignLoanInfoViewModel.LoanId, user.UserAccountId);
                    isLoanNumberAssigned = int.TryParse(loanNum, out loanNumber) && loanNumber > 0;
                }

                bool isSubmited = LoanServiceFacade.AssignConciergeLoanNumberAndLOA(assignLoanInfoViewModel.LoanId, conciergeId, assignLoanInfoViewModel.LoanNumber, assignLoanInfoViewModel.ConciergeNMLS, companyId, assignLoanInfoViewModel.ChannelId, assignLoanInfoViewModel.DivisionId, assignLoanInfoViewModel.BranchId, assignLoanInfoViewModel.EnableDigitalDocsCall, user.UserAccountId, loaId, callCenterId);

                if (isSubmited)
                {
                    int losFolderId = int.Parse(assignLoanInfoViewModel.LosFolder);
                    isSubmited = LoanServiceFacade.UpdateLosFolderId(assignLoanInfoViewModel.LoanId, losFolderId, user.UserAccountId);
                }

                if (isSubmited)
                {
                    isSubmited = ActivitiesServiceFacade.ExecuteActivityRulesConcierge(ActivitiesServiceFacade.RetrieveActivity(assignLoanInfoViewModel.LoanId, ActivityType.CompleteLoanApplication, user.UserAccountId).Id,
                                                                                       ActivityStatus.Completed, ActivityMode.None, false, ActionIntent.LoanNoAndConciergeAssigned, user.Party.Id, user.UserAccountId, loanNumberAlreadyAssigned: isLoanNumberAssigned);
                }

                return(isSubmited);
            }
            catch (Exception exception)
            {
                TraceHelper.Error(TraceCategory.Global, "ExportToLOS::LosFolderUpdated", exception, assignLoanInfoViewModel.LoanId, user != null ? user.UserAccountId : -1);
                return(false);
            }
        }