protected Guardian CheckGuardianExists(ISession session, string guardianKey)
        {
            Guardian guardian = null;
            try { 
            guardian = session.CreateCriteria(typeof(Guardian))
               .List<Guardian>().FirstOrDefault(x => x.Member.MemberKey.Equals(guardianKey));

            }
            catch (NullReferenceException) { }

            if (guardian != null) return guardian;

            var member = session.CreateCriteria(typeof(Member))
                .List<Member>().FirstOrDefault(x => x.MemberKey.Equals(guardianKey));

            if (member == null) return null;

            guardian = new Guardian {Member = member};
            guardian.Init();

            return guardian;
        }
        public bool AddGuardians(List<DLGuardian> guardianList)
        {
            using (var session = NHibernateHelper.OpenSession())
            {
                using (var transaction = session.BeginTransaction())
                {
                    try
                    {
                        var memberType = new MemberType
                        {
                            Name = "Guardian"
                        };

                        memberType.Init();
                        SetAudit(memberType);
                        session.SaveOrUpdate(memberType);

                        foreach (var dlGuardian in guardianList)
                        {
                            var member = session.CreateCriteria(typeof (Member))
                                .List<Member>().FirstOrDefault(x => x.LegacyId.Equals(dlGuardian.LegacyMemberId));

                            member.AddMemberType(memberType);
                            SetAudit(member);
                            session.SaveOrUpdate(member);

                            var guardian = new Guardian
                            {
                                Member = member
                            };

                            guardian.Init();
                            SetAudit(guardian);
                            session.SaveOrUpdate(guardian);
                        }

                        transaction.Commit();
                        return true;
                    }
                    catch (Exception ex)
                    {
                        Logger.Log(LogLevel.Error, ex, string.Empty, null);
                        transaction.Rollback();
                        return false;
                    }
                }
            }
        }