public ApprovalTransactionViewModel UpdateOpening(EntityAndApprovalViewModel entityAndApprovalViewModel)
        {
            var openingViewModel = entityAndApprovalViewModel.openingViewModel;
            var openingModel     = new Openings();

            openingModel.MapFromViewModel(openingViewModel, (ClaimsIdentity)_principal.Identity);
            var openingDetail      = _openingRepository.GetByID(openingViewModel.OpeningId);
            var skillViewModelList = openingViewModel.PrimarySkillTypes.Union(openingViewModel.SecondarySkillTypes).ToList();
            var skillModelList     = openingDetail.OpeningSkills.Where(x => (x.IsActive && !x.IsDeleted)).Select(x => x.Skill).ToList();

            var existingSkills = skillViewModelList.Select(x => x.SkillId).Intersect(skillModelList.Select(x => x.SkillId)).ToList();
            var addingSkills   = skillViewModelList.Select(x => x.SkillId).Except(existingSkills).ToList();
            var removingSkills = skillModelList.Select(x => x.SkillId).Except(existingSkills).ToList();

            if (existingSkills.Any())
            {
                var openingSkills = openingDetail.OpeningSkills.Where(x => existingSkills.Contains(x.SkillId)).ToList();
                openingSkills.ForEach(x => x.MapAuditColumns((ClaimsIdentity)_principal.Identity));
            }

            if (removingSkills.Any())
            {
                var openingSkills = openingDetail.OpeningSkills.Where(x => removingSkills.Contains(x.SkillId)).ToList();
                openingSkills.ForEach(x => x.MapDeleteColumns((ClaimsIdentity)_principal.Identity));
            }

            var openingSkillList = new List <OpeningSkills>();

            if (addingSkills.Any())
            {
                var addingSkillList = skillViewModelList.Where(x => addingSkills.Contains(x.SkillId)).ToList();
                foreach (var item in addingSkillList)
                {
                    var openingSkill = new OpeningSkills()
                    {
                        OpeningId = openingDetail.OpeningId,
                        SkillId   = item.SkillId,
                        SkillType = item.OpeningSkillType
                    };
                    openingSkill.MapAuditColumns((ClaimsIdentity)_principal.Identity);
                    openingSkillList.Add(openingSkill);
                }
            }

            if (openingSkillList.Any())
            {
                _openingRepository.UpdateOpeningSkills(openingSkillList);
            }
            _openingRepository.Update(openingModel);
            entityAndApprovalViewModel.approvalTransactionViewModel.NextEventOrderNumber += 1;
            _approvalManagerService.ManageApprovalTransaction(entityAndApprovalViewModel);
            _openingRepository.SaveChanges();
            return(entityAndApprovalViewModel.approvalTransactionViewModel);
        }
        public IResult ManageApprovalTransaction([FromBody] EntityAndApprovalViewModel entityAndApprovalViewModel)
        {
            var createdEventRole = _approvalManager.ManageApprovalTransaction(entityAndApprovalViewModel);

            return(createdEventRole);
        }