public virtual ActionResult UpdateBranch(BranchDto dto)
        {
            bool   isSuccess    = true;
            string alertMessage = string.Empty;

            var oldBranch = _branchService.FindBranchById(dto.BranchId);

            dto.BranchId = oldBranch.BranchId;

            dto.UpdatedBy = Session[SessionVariables.UserDetails].GetUserIdFromSession();

            List <BranchDto> duplicateList = new List <BranchDto>();

            duplicateList = _branchService.GetAll().Where(b => b.BranchName == dto.BranchName && b.BranchId != dto.BranchId).ToList();

            if (duplicateList.Count > 0)
            {
                isSuccess = false;
                Danger(string.Format(Messages.DuplicateItem, "Branch"));
            }
            else
            {
                if (!_branchService.UpdateBranch(dto))
                {
                    isSuccess = false;
                    Danger(Messages.ErrorOccuredDuringProcessing);
                }
                else
                {
                    Success(Messages.UpdateSuccess);
                }
            }

            alertMessage = this.RenderRazorViewToString(IOBALANCEMVC.Shared.Views._Alerts, string.Empty);
            var jsonResult = new
            {
                isSuccess    = isSuccess,
                alertMessage = alertMessage
            };

            return(Json(jsonResult, JsonRequestBehavior.AllowGet));
        }