public void CreateAccount(MailAccount mailbox)
		{
			Tree users = AMSHelper.GetUsersConfig();
			AmsMailbox accnt = new AmsMailbox(mailbox.Name);

			if (accnt.Load(users))
				throw new Exception("Mailbox is already registered.");

			accnt.Read(mailbox);

			if (!accnt.Save(users))
				throw new Exception("Couldn't create a mailbox.");
		}
        public void CreateAccount(MailAccount mailbox)
        {
            Tree       users = AMSHelper.GetUsersConfig();
            AmsMailbox accnt = new AmsMailbox(mailbox.Name);

            if (accnt.Load(users))
            {
                throw new Exception("Mailbox is already registered.");
            }

            accnt.Read(mailbox);

            if (!accnt.Save(users))
            {
                throw new Exception("Couldn't create a mailbox.");
            }
        }
        public void CreateGroup(MailGroup group)
        {
            Tree       users    = AMSHelper.GetUsersConfig();
            AmsMailbox amsGroup = new AmsMailbox(group.Name);

            if (amsGroup.Load(users))
            {
                throw new Exception("Mail group is already exists.");
            }

            amsGroup.Read(group);

            if (!amsGroup.Save(users))
            {
                throw new Exception("Couldn't create a mail group.");
            }
        }
        public void UpdateGroup(MailGroup group)
        {
            Tree       config   = AMSHelper.GetUsersConfig();
            AmsMailbox amsGroup = new AmsMailbox(group.Name);

            if (amsGroup.Load(config))
            {
                amsGroup.LoadAccountConfig();
                amsGroup.Read(group);

                if (!amsGroup.Save(config))
                {
                    throw new Exception("Couldn't update specified mail group.");
                }
            }
            else
            {
                throw new Exception("Couldn't find specified mail group.");
            }
        }
        public void UpdateAccount(MailAccount mailbox)
        {
            Tree       config     = AMSHelper.GetUsersConfig();
            AmsMailbox amsMailbox = new AmsMailbox(mailbox.Name);

            if (amsMailbox.Load(config))
            {
                amsMailbox.LoadAccountConfig();
                amsMailbox.Read(mailbox);

                if (!amsMailbox.Save(config))
                {
                    throw new Exception("Couldn't update specified mailbox.");
                }
            }
            else
            {
                throw new Exception("Couldn't find specified mailbox.");
            }
        }
		public void UpdateGroup(MailGroup group)
		{
			Tree config = AMSHelper.GetUsersConfig();
			AmsMailbox amsGroup = new AmsMailbox(group.Name);

			if (amsGroup.Load(config))
			{
				amsGroup.LoadAccountConfig();
				amsGroup.Read(group);

				if (!amsGroup.Save(config))
					throw new Exception("Couldn't update specified mail group.");
			}
			else
			{
				throw new Exception("Couldn't find specified mail group.");
			}
		}
		public void UpdateAccount(MailAccount mailbox)
		{
			Tree config = AMSHelper.GetUsersConfig();
			AmsMailbox amsMailbox = new AmsMailbox(mailbox.Name);

			if (amsMailbox.Load(config))
			{
				amsMailbox.LoadAccountConfig();
				amsMailbox.Read(mailbox);

				if (!amsMailbox.Save(config))
					throw new Exception("Couldn't update specified mailbox.");
			}
			else
			{
				throw new Exception("Couldn't find specified mailbox.");
			}
		}
		public void CreateGroup(MailGroup group)
		{
			Tree users = AMSHelper.GetUsersConfig();
			AmsMailbox amsGroup = new AmsMailbox(group.Name);

			if (amsGroup.Load(users))
				throw new Exception("Mail group is already exists.");

			amsGroup.Read(group);

			if (!amsGroup.Save(users))
				throw new Exception("Couldn't create a mail group.");
		}