private void CreateUser(string email, string name, string password, bool isApproved, bool isLockedOut, bool createRoles)
        {
            var dataSource      = DependencyInjector.Get <IMembershipDataSource>();
            var securityService = DependencyInjector.Get <ISecurityManager>();
            var mainGroupId     = dataSource.Query <Group>().Where(g => g.Name.ToLower() == Resources.DefaultValues.MainGroupName.ToLower()).Select(a => a.Id).FirstOrDefault();

            var user = new User(Guid.NewGuid(), email, name);

            user.PreferredCulture = StrixPlatform.DefaultCultureCode;
            var userSecurity = new UserSecurity(user.Id);

            userSecurity.Password  = securityService.EncodePassword(password);
            userSecurity.Approved  = isApproved;
            userSecurity.LockedOut = isLockedOut;
            dataSource.Save(userSecurity);
            var userSession = new UserSessionStorage(user.Id);

            dataSource.Save(userSession);
            dataSource.Save(user);

            if (createRoles)
            {
                var adminRole  = dataSource.Query <GroupInRole>().First(g => g.Role.Name == PlatformConstants.ADMINROLE);
                var userInRole = new UserInRole(adminRole, user.Id);
                dataSource.Save(userInRole);
            }

            dataSource.SaveChanges();
        }
        private void CreateUser(string email, string name, string password, bool isApproved, bool isLockedOut, bool createRoles)
        {
            var dataSource = DependencyInjector.Get<IMembershipDataSource>();
            var securityService = DependencyInjector.Get<ISecurityManager>();
            var mainGroupId = dataSource.Query<Group>().Where(g => g.Name.ToLower() == Resources.DefaultValues.MainGroupName.ToLower()).Select(a => a.Id).FirstOrDefault();

            var user = new User(Guid.NewGuid(), email, name);
            user.PreferredCulture = StrixPlatform.DefaultCultureCode;
            var userSecurity = new UserSecurity(user.Id);
            userSecurity.Password = securityService.EncodePassword(password);
            userSecurity.Approved = isApproved;
            userSecurity.LockedOut = isLockedOut;
            dataSource.Save(userSecurity);
            var userSession = new UserSessionStorage(user.Id);
            dataSource.Save(userSession);
            dataSource.Save(user);

            if (createRoles)
            {
                var adminRole = dataSource.Query<GroupInRole>().First(g => g.Role.Name == PlatformConstants.ADMINROLE);
                var userInRole = new UserInRole(adminRole, user.Id);
                dataSource.Save(userInRole);
            }

            dataSource.SaveChanges();
        }