/// <summary>
        /// Creates a new estate.
        /// </summary>
        /// <param name="scene">Scene.</param>
        /// <param name="cmd">Cmd.</param>
        protected void CreateEstateCommand(IScene scene, string [] cmd)
        {
            IEstateConnector      estateConnector = Framework.Utilities.DataManager.RequestPlugin <IEstateConnector> ();
            IUserAccountService   accountService  = m_registry.RequestModuleInterface <IUserAccountService> ();
            ISystemAccountService sysAccounts     = m_registry.RequestModuleInterface <ISystemAccountService> ();

            string estateName  = "";
            string estateOwner = sysAccounts.SystemEstateOwnerName;

            // check for passed estate name
            estateName = (cmd.Length < 3)
                ? MainConsole.Instance.Prompt("Estate name", estateName)
                : cmd [2];
            if (estateName == "")
            {
                return;
            }

            // verify that the estate does not already exist
            if (estateConnector.EstateExists(estateName))
            {
                MainConsole.Instance.ErrorFormat("[EstateService]: The estate '{0}' already exists!", estateName);
                return;
            }

            // owner?
            estateOwner = (cmd.Length > 3)
                ? Util.CombineParams(cmd, 4)  // in case of spaces in the name eg Allan Allard
                : MainConsole.Instance.Prompt("Estate owner: ", estateOwner);
            if (estateOwner == "")
            {
                return;
            }


            // check to make sure the user exists
            UserAccount account = accountService.GetUserAccount(null, estateOwner);

            if (account == null)
            {
                MainConsole.Instance.WarnFormat("[User account service]: The user, '{0}' was not found!", estateOwner);

                // temporary fix until remote user creation can be implemented
                if (accountService.IsLocalConnector)
                {
                    string createUser = MainConsole.Instance.Prompt("Do you wish to create this user?  (yes/no)", "yes").ToLower();
                    if (!createUser.StartsWith("y", StringComparison.Ordinal))
                    {
                        return;
                    }

                    // Create a new account
                    string password = MainConsole.Instance.PasswordPrompt(estateOwner + "'s password");
                    string email    = MainConsole.Instance.Prompt(estateOwner + "'s email", "");

                    accountService.CreateUser(estateOwner, Util.Md5Hash(password), email);
                    // CreateUser will tell us success or problem
                    account = accountService.GetUserAccount(null, estateOwner);

                    if (account == null)
                    {
                        MainConsole.Instance.ErrorFormat(
                            "[EstateService]: Unable to store account details.\n   If this simulator is connected to a grid, create the estate owner account first at the grid level.");
                        return;
                    }
                }
                else
                {
                    MainConsole.Instance.WarnFormat("[User account service]: The user must be created on the Grid before assigning an estate!");
                    MainConsole.Instance.WarnFormat("[User account service]: Regions should be assigned to the system user estate until this can be corrected");

                    return;
                }
            }

            // check for bogies...
            if (Utilities.IsSystemUser(account.PrincipalID))
            {
                MainConsole.Instance.Info("[EstateService]: Tsk, tsk.  System users should not be used as estate managers!");
                return;
            }

            // we have an estate name and a user
            // Create a new estate
            var ES = new EstateSettings();

            ES.EstateName  = estateName;
            ES.EstateOwner = account.PrincipalID;

            ES.EstateID = (uint)estateConnector.CreateNewEstate(ES);
            if (ES.EstateID == 0)
            {
                MainConsole.Instance.Warn("There was an error in creating this estate: " + ES.EstateName);
                //EstateName holds the error. See LocalEstateConnector for more info.
            }
            else
            {
                MainConsole.Instance.InfoFormat("[EstateService]: The estate '{0}' owned by '{1}' has been created.", estateName, estateOwner);
            }
        }
        private void CheckSystemEstateInfo(IEstateConnector estateConnector)
        {
            // these should have already been checked but just make sure...
            if (estateConnector == null)
                return;

            if (estateConnector.RemoteCalls ())
                return;

            if (estateConnector.EstateExists (Constants.SystemEstateName))
                return;

            // Create a new estate
            EstateSettings ES = new EstateSettings();
            ES.EstateName = Constants.SystemEstateName;
            ES.EstateOwner = (UUID) Constants.RealEstateOwnerUUID;

            ES.EstateID = (uint) estateConnector.CreateNewEstate(ES);
            if (ES.EstateID == 0)
            {
                MainConsole.Instance.Warn("There was an error in creating the system estate: " + ES.EstateName);
                //EstateName holds the error. See LocalEstateConnector for more info.

            } else {
                MainConsole.Instance.InfoFormat("[EstateService]: The estate '{0}' owned by '{1}' has been created.",
                    Constants.SystemEstateName, Constants.RealEstateOwnerName);
            }
        }