/// <summary>
        /// Insert a new user
        /// </summary>
        /// <param name="user"/>
        /// <returns/>
        public Task CreateAsync(BackOfficeIdentityUser user)
        {
            ThrowIfDisposed();
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            //the password must be 'something' it could be empty if authenticating
            // with an external provider so we'll just generate one and prefix it, the
            // prefix will help us determine if the password hasn't actually been specified yet.
            //this will hash the guid with a salt so should be nicely random
            var aspHasher          = new PasswordHasher();
            var emptyPasswordValue = Constants.Security.EmptyPasswordPrefix +
                                     aspHasher.HashPassword(Guid.NewGuid().ToString("N"));

            var userEntity = new User(user.Name, user.Email, user.UserName, emptyPasswordValue)
            {
                DefaultToLiveEditing = false,
                Language             = user.Culture ?? _globalSettings.DefaultUILanguage,
                StartContentIds      = user.StartContentIds ?? new int[] { },
                StartMediaIds        = user.StartMediaIds ?? new int[] { },
                IsLockedOut          = user.IsLockedOut,
            };

            // we have to remember whether Logins property is dirty, since the UpdateMemberProperties will reset it.
            var isLoginsPropertyDirty = user.IsPropertyDirty(nameof(BackOfficeIdentityUser.Logins));

            UpdateMemberProperties(userEntity, user);

            _userService.Save(userEntity);

            if (!userEntity.HasIdentity)
            {
                throw new DataException("Could not create the user, check logs for details");
            }

            //re-assign id
            user.Id = userEntity.Id;

            if (isLoginsPropertyDirty)
            {
                _externalLoginService.Save(
                    user.Id,
                    user.Logins.Select(x => new ExternalLogin(
                                           x.LoginProvider,
                                           x.ProviderKey,
                                           (x is IIdentityUserLoginExtended extended) ? extended.UserData : null)));
            }

            return(Task.FromResult(0));
        }