public IResult InsertOrUpdateOpening(EntityAndApprovalViewModel entityAndApprovalViewModel)
        {
            var result = new Result
            {
                Operation = Operation.Create,
                Status    = Status.Success
            };

            try
            {
                var openingViewModel = entityAndApprovalViewModel.openingViewModel;
                if (openingViewModel.OpeningId != Guid.Empty)
                {
                    result.Body = UpdateOpening(entityAndApprovalViewModel);
                }
                else
                {
                    var openingModel = new Openings();
                    openingModel.MapFromViewModel(openingViewModel, (ClaimsIdentity)_principal.Identity);
                    var openingSkillList = new List <OpeningSkills>();
                    var openingSkills    = openingViewModel.PrimarySkillTypes.Union(openingViewModel.SecondarySkillTypes).ToList();

                    foreach (var item in openingSkills)
                    {
                        var openingSkill = new OpeningSkills
                        {
                            SkillId   = item.SkillId,
                            SkillType = item.OpeningSkillType
                        };
                        openingSkill.MapAuditColumns((ClaimsIdentity)_principal.Identity);
                        openingSkillList.Add(openingSkill);
                    }
                    _openingRepository.CreateOpening(openingModel, openingSkillList);

                    entityAndApprovalViewModel.openingViewModel.OpeningId = openingModel.OpeningId;
                    var approvalTransactionViewModel = _approvalManagerService.AddApprovalTransaction(entityAndApprovalViewModel);

                    // var users = _approvalRepository.GetUserForOpeningApproval(approvalTransactionViewModel);
                    //users.ForEach(user =>
                    //{
                    //    MailDetailModel mailDetail = new MailDetailModel();
                    //    mailDetail.EmailId = user.Email;
                    //    mailDetail.Subject = "Opening Approval";
                    //    mailDetail.Template = TemplateType.Appoval;
                    //    mailDetail.MessageBody = approvalTransactionViewModel;
                    //    GenericHelper.Send(mailDetail, _configuration);
                    //});
                    result.Body = approvalTransactionViewModel;
                }
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                result.Status  = Status.Fail;
            }
            return(result);
        }