public override IRecord GetJwsRecord(IClientRecord record)
        {
            var clientRecord = record as SourceRecord;
            if (clientRecord == null)
            {
                return null;
            }

            
            var result = new Record();
            //JwsCompanyId = Core.Constants.CompanyNumbers.BaptistHealth
            result.Tier1CompanyId = clientRecord.JwsCompanyId;
            result.LastName = clientRecord.LastName;
            result.FirstName = clientRecord.FirstName;
            result.MiddleInitial = clientRecord.MiddleInitial;
            result.SocialSecurityNumber = clientRecord.SocialSecurityNumber;
            result.Gender = clientRecord.Gender;
            result.DateOfBirth = clientRecord.DateOfBirth;
            result.AddressLine1 = clientRecord.Address1;
            result.City = clientRecord.City;
            result.State = clientRecord.State;
            result.ZipCode = clientRecord.ZipCode;
            result.HireDate = clientRecord.HireDate;
            result.EmployeeId = clientRecord.EmployeeId;
            result.PayRate = clientRecord.PayRate;
            result.MaritalStatus = clientRecord.MaritalStatus;
            result.AddressLine1 = clientRecord.Address1;
            result.AddressLine2 = clientRecord.Address2;
            //result.PayRatePerPayPeriod = clientRecord.PayRate;

            

            string departmentNumber = null;
            string divisionName = clientRecord.DivisionName;
            string name = string.Empty;
            if (!clientRecord.DepartmentNumber.IsEmpty())
            {
                departmentNumber = clientRecord.DepartmentNumber;
                name = clientRecord.DepartmentName;
            }
            
            


            var args = new OrgLevelEventArgs(record.JwsCompanyId,result)
            {
                CompanyId = result.Tier1CompanyId,
                DivisionName = divisionName,
                DepartmentNumber = departmentNumber,
                
                Name =  name

            };

            
            OnOrgLevelEvent(args);
            result.TierName = args.CostCenterName;

            return result;
        }
        public override IRecord GetJwsRecord(IClientRecord record)
        {
            var clientRecord = record as SourceRecord;
            if (clientRecord == null)
            {
                return null;
            }

            
            var result = new Record();
            result.Tier1CompanyId = clientRecord.JwsCompanyId;
            result.LastName = clientRecord.LastName;
            result.FirstName = clientRecord.FirstName;
            result.MiddleInitial = clientRecord.MiddleInitial;
            result.SocialSecurityNumber = clientRecord.SocialSecurityNumber;
            result.Gender = clientRecord.Gender;
            result.DateOfBirth = clientRecord.DateOfBirth;
            result.AddressLine1 = clientRecord.Address1;
            result.City = clientRecord.City;
            result.State = clientRecord.State;
            result.ZipCode = clientRecord.ZipCode;
            result.HireDate = clientRecord.HireDate;
            
            var args = new OrgLevelEventArgs(record.JwsCompanyId,result)
            {
                CompanyId = result.Tier1CompanyId,
            };

            
            OnOrgLevelEvent(args);


            return result;
        }
        public override IRecord GetJwsRecord(IClientRecord record)
        {
            var clientRecord = record as SourceRecord;
            if (clientRecord == null)
            {
                return null;
                //throw new ArgumentException("Client Record is Empty or Invalid type");
            }

            //var propertyNames = clientRecord.PropertyNames();
            //foreach (var propertyName in propertyNames)
            //{
            //    Console.WriteLine(propertyName);
            //}
            //result.TierLevel = ??
            //result.TierLevelId = ??
            //result.TierName = ??
            //result.UserLevel = ??
            //result.IndexCode = ??
            //result.NumberPayPeriods = ??
            var result = new Record();
            result.Tier1CompanyId = clientRecord.JwsCompanyId;
            result.LastName = clientRecord.LastName;
            result.FirstName = clientRecord.FirstName;
            result.MiddleInitial = clientRecord.MiddleInitial;
            result.SocialSecurityNumber = clientRecord.SocialSecurityNumber;
            result.Gender = clientRecord.Gender;
            result.DateOfBirth = clientRecord.DateOfBirth;
            result.MaritalStatus = clientRecord.MaritalStatus;
            result.AddressLine1 = clientRecord.Address1;
            result.AddressLine2 = clientRecord.Address2;
            result.City = clientRecord.City;
            result.State = clientRecord.State;
            result.ZipCode = clientRecord.ZipCode;
            result.EmployeeId = clientRecord.EmployeeId;
            result.JobDescription = clientRecord.JobTitle;
            result.JobClassCode = clientRecord.JobClassCode;
            result.DaysWorkedPerWeek = (decimal)clientRecord.DaysWorkedPerWeek;
            result.HoursWorkedPerDay = (decimal)clientRecord.HoursWorkedPerDay;
            //result.DivisionNumber = clientRecord.DivisionNumber;
            result.PayRateType = clientRecord.PayRateType;
            result.PayRate = clientRecord.PayRate;
            result.HireDate = clientRecord.HireDate;

            //var companyNumber = result.Tier1CompanyId;
            //InitializeOrganizationList(companyNumber);

            var args = new OrgLevelEventArgs(record.JwsCompanyId,result)
            {
                CompanyId = result.Tier1CompanyId,
                DivisonNumber = clientRecord.DivisionNumber
            };

            
            OnOrgLevelEvent(args);


            return result;
        }
        public override IRecord GetJwsRecord(IClientRecord record)
        {
            var clientRecord = record as SourceRecord;
            if (clientRecord == null)
            {
                return null;
            }


            var result = new Record();

            result.Tier1CompanyId = clientRecord.JwsCompanyId;
            result.LastName = clientRecord.LastName;
            result.FirstName = clientRecord.FirstName;
            result.MiddleInitial = clientRecord.MiddleInitial;
            result.SocialSecurityNumber = clientRecord.SocialSecurityNumber;
            result.Gender = clientRecord.Gender;
            result.DateOfBirth = clientRecord.DateOfBirth;
            result.AddressLine1 = clientRecord.Address1;
            result.City = clientRecord.City;
            result.State = clientRecord.State;
            result.ZipCode = clientRecord.ZipCode;
            result.HireDate = clientRecord.HireDate;
            result.PhoneNumber = clientRecord.PhoneNumber;
            result.EmployeeId = clientRecord.EmployeeId;
            //result.PayRatePerPayPeriod = clientRecord.PayRatePerPeriod;
            result.HoursWorkedPerDay = clientRecord.HoursWorkedPerDay;
            result.JobClassCode = clientRecord.JobClassCode;
            result.JobDescription = clientRecord.JobDescription;
            result.PayRate = clientRecord.PayRate ?? 0;
            result.PayRateType = clientRecord.PayRateType;
            result.MaritalStatus = clientRecord.MaritalStatus;
            result.AddressLine1 = clientRecord.Address1;
            result.AddressLine2 = clientRecord.Address2;
            result.AnnualHours = clientRecord.AnnualHours;
            result.UnionCode = clientRecord.UnionCode;
            result.OccupationCode = clientRecord.OccupationCode;
            string departmentNumber = null;


            if (!clientRecord.DepartmentNumber.IsEmpty())
            {
                departmentNumber = clientRecord.DepartmentNumber;
            }
            


            var args = new OrgLevelEventArgs(record.JwsCompanyId, result)
            {
                CompanyId = result.Tier1CompanyId,
                DepartmentNumber = departmentNumber,
            };


            OnOrgLevelEvent(args);
            result.TierName = args.CostCenterName;

            return result;
        }
        public override IRecord GetJwsRecord(IClientRecord record)
        {
            var clientRecord = record as SourceRecord;
            if (clientRecord == null)
            {
                return null;
            }


            var result = new Record();

            result.Tier1CompanyId = clientRecord.JwsCompanyId;
            result.LastName = clientRecord.LastName;
            result.FirstName = clientRecord.FirstName;
            result.MiddleInitial = clientRecord.MiddleInitial;
            result.NameSuffix = clientRecord.NameSuffix;

            result.SocialSecurityNumber = clientRecord.SocialSecurityNumber;
            result.Gender = clientRecord.Gender;
            result.MaritalStatus = clientRecord.MaritalStatus;

            result.DateOfBirth = clientRecord.DateOfBirth;
            result.AddressLine1 = clientRecord.Address1;
            result.PhoneNumber = clientRecord.PhoneNumber;
            result.City = clientRecord.City;
            result.State = clientRecord.State;
            result.ZipCode = clientRecord.ZipCode;
            result.HireDate = clientRecord.HireDate;
            result.EmployeeId = clientRecord.EmployeeId;
            
            result.HoursWorkedPerDay = (decimal)clientRecord.HoursWorkedPerDay;
            result.PayRate = clientRecord.PayRate;
            result.MaritalStatus = clientRecord.MaritalStatus;
            result.AddressLine1 = clientRecord.Address1;
            result.AddressLine2 = clientRecord.Address2;
            result.DaysWorkedPerWeek = clientRecord.DaysWorkedPerWeek;
            result.JobClassCode = clientRecord.JobClassCode;
            result.JobDescription = clientRecord.JobDescription;
            

            

            var args = new OrgLevelEventArgs(record.JwsCompanyId, result)
            {
                CompanyId = result.Tier1CompanyId,
                DivisonNumber = clientRecord.DivisionNumber,
                
                
            };
            

            OnOrgLevelEvent(args);
            result.TierName = args.CostCenterName;

            return result;
        }
        public override IRecord GetJwsRecord(IClientRecord record)
        {
            var clientRecord = record as SourceRecord;
            if (clientRecord == null)
            {
                return null;
            }

            
            var result = new Record();
            
            result.Tier1CompanyId = clientRecord.JwsCompanyId;
            result.LastName = clientRecord.LastName;
            result.FirstName = clientRecord.FirstName;
            result.MiddleInitial = clientRecord.MiddleInitial;
            result.SocialSecurityNumber = clientRecord.SocialSecurityNumber;
            result.Gender = clientRecord.Gender;
            result.DateOfBirth = clientRecord.DateOfBirth;
            result.AddressLine1 = clientRecord.Address1;
            result.City = clientRecord.City;
            result.State = clientRecord.State;
            result.ZipCode = clientRecord.ZipCode;
            result.HireDate = clientRecord.HireDate;
            result.EmployeeId = clientRecord.EmployeeId;
            //result.PayRatePerPayPeriod = clientRecord.PayRateType;
            result.PayRate = clientRecord.PayRate??0;
            result.MaritalStatus = clientRecord.MaritalStatus;
            result.AddressLine1 = clientRecord.Address1;
            result.AddressLine2 = clientRecord.Address2;
            //result.PayRatePerPayPeriod = clientRecord.;

            
            
            var args = new OrgLevelEventArgs(record.JwsCompanyId,result)
            {
                CompanyId = result.Tier1CompanyId,
                DivisionName = clientRecord.DivisionName,
                DivisonNumber = clientRecord.DivisionNumber,
                
            };

            
            OnOrgLevelEvent(args);
            result.TierName = args.CostCenterName;

            return result;
        }
        private void JwsConverter_MapOrgLevelHandler(object sender, OrgLevelEventArgs e)
        {
            var level = 0;
            var name = string.Empty;
            var number = string.Empty;
            if (e.DivisonNumber.IsEmpty() && e.DepartmentNumber.IsEmpty()) return;

            var organizationSet = false;
            if (_oranizartions == null)
            {
                _oranizartions = new Organization(e.CompanyId);
                var tiers = _oranizartions.Tiers;
                var count = _oranizartions.Tiers.Count;
            }

            //tiers.Where(c => c.Id == )

            if (!e.DivisonNumber.IsEmpty())
            {
                var subOrgs = _oranizartions.Tiers.Where(c => c.Number == e.DivisonNumber).ToList();
                var orgLevel4 = _oranizartions.Tiers.Where(c => c.TierLevel == 3 && c.Id.Contains(e.DivisonNumber)).ToList();
                level = 3;
                number = e.DivisonNumber;
            }
            if (!e.DivisionName.IsEmpty())
            {
                var subOrgs = _oranizartions.Tiers.Where(c => c.TierLevel == 3 && c.Name.ToUpper() == e.DivisionName.ToUpper()).ToList();
                if (subOrgs.Any())
                {
                    var division = subOrgs.First();
                    e.Record.TierLevel = 3;
                    e.Record.TierLevelId = division.Id;
                    e.CostCenterName = division.Name;
                    organizationSet = true;
                }
                level = 3;
                name = e.DivisionName;
                number = e.DivisonNumber;
            }
            if (!e.DepartmentNumber.IsEmpty() && !e.Name.IsEmpty())
            {
                var subOrgs = _oranizartions.Tiers.Where(c => c.TierLevel == 4 && c.Name.ToUpper() == e.Name.ToUpper()).ToList();
                if (subOrgs.Any())
                {
                    var department = subOrgs.First();
                    e.Record.TierLevel = 4;
                    e.Record.TierLevelId = department.Id;
                    e.CostCenterName = department.Name;
                    organizationSet = true;
                }
                level = 4;
                name = e.Name;
                number = e.DepartmentNumber;
            }
            else if (!e.DepartmentNumber.IsEmpty())
            {
                var subOrgs = _oranizartions.Tiers.Where(c => c.TierLevel == 4 && c.Id == e.DepartmentNumber.PadLeft(6, '0')).ToList();
                if (subOrgs.Any())
                {
                    var department = subOrgs.First();
                    e.Record.TierLevel = 4;
                    e.Record.TierLevelId = department.Id;
                    e.CostCenterName = department.Name;
                    organizationSet = true;
                }
                level = 4;
                number = e.DepartmentNumber;
            }
            if (!e.Level5Number.IsEmpty())
            {
                var subOrgs = _oranizartions.Tiers.Where(c => c.Id.Contains(e.Level5Number)).ToList();
                var orgLevel5 = _oranizartions.Tiers.Where(c => c.TierLevel == 5).ToList();

                level = 5;
            }




            if (!organizationSet)
            {
                var subOrg = _oranizartions.Tiers.FirstOrDefault(c => c.TierLevel == 2);
                e.Record.TierLevel = 2;
                e.Record.TierLevelId = subOrg.Id;

                var invalidOrgLevel = new InvalidOrgLevel
                {
                    Level = level,
                    Name = name,
                    Number = number
                };

                LogMissingMappings(invalidOrgLevel);

            }



        }
 protected void OnOrgLevelEvent(OrgLevelEventArgs args)
 {
     MapOrgLevelHandler?.Invoke(this, args);
 }