private static void AddInitialUser(this IDbAppContext context, User initialUser)
        {
            User user = context.GetUserBySmUserId(initialUser.SmUserId);

            if (user != null)
            {
                return;
            }

            user = new User
            {
                Active    = true,
                Email     = initialUser.Email,
                GivenName = initialUser.GivenName,
                Initials  = initialUser.Initials,
                SmAuthorizationDirectory = initialUser.SmAuthorizationDirectory,
                SmUserId = initialUser.SmUserId,
                Surname  = initialUser.Surname
            };


            District district = null;

            if (initialUser.District != null)
            {
                district = context.GetDistrictByMinistryDistrictId(initialUser.District.MinistryDistrictID);
            }

            user.District = district;

            context.Users.Add(user);
            context.SaveChanges();

            string[] userRoles = initialUser.UserRoles.Select(x => x.Role.Name).ToArray();

            if (user.UserRoles == null)
            {
                user.UserRoles = new List <UserRole>();
            }

            foreach (string userRole in userRoles)
            {
                Role role = context.GetRole(userRole);
                if (role != null)
                {
                    user.UserRoles.Add(
                        new UserRole
                    {
                        EffectiveDate = DateTime.UtcNow,
                        Role          = role
                    });
                }
            }

            string[] userGroups = initialUser.GroupMemberships.Select(x => x.Group.Name).ToArray();
            if (user.GroupMemberships == null)
            {
                user.GroupMemberships = new List <GroupMembership>();
            }

            foreach (string userGroup in userGroups)
            {
                Group group = context.GetGroup(userGroup);
                if (group != null)
                {
                    user.GroupMemberships.Add(
                        new GroupMembership
                    {
                        Active = true,
                        Group  = context.GetGroup("Other")
                    });
                }
            }

            context.Users.Update(user);
            context.SaveChanges();
        }