public ExchangeAccount[] GetExchangeAccountsPaged(int itemId, string accountTypes,
			string filterColumn, string filterValue,
			int maximumRows, int startRowIndex, string sortColumn)
		{
			if (!String.IsNullOrEmpty(filterValue))
				filterValue = filterValue + "%";

			accounts = ES.Services.ExchangeServer.GetAccountsPaged(itemId,
                accountTypes, filterColumn, filterValue, sortColumn, startRowIndex, maximumRows);

			return accounts.PageItems;
		}
        public static ExchangeAccountsPaged GetAccountsPaged(int itemId, string accountTypes,
            string filterColumn, string filterValue, string sortColumn,
            int startRow, int maximumRows, bool archiving)
        {
            #region Demo Mode
            if (IsDemoMode)
            {
                string[] parseedAccountTypes = Utils.ParseDelimitedString(accountTypes, ',');

                ExchangeAccountsPaged res = new ExchangeAccountsPaged();
                res.PageItems = GetAccounts(itemId, (ExchangeAccountType)Utils.ParseInt(parseedAccountTypes[0], 1)).ToArray();
                res.RecordsCount = res.PageItems.Length;
                return res;
            }
            #endregion

            DataSet ds = DataProvider.GetExchangeAccountsPaged(SecurityContext.User.UserId, itemId,
                accountTypes, filterColumn, filterValue, sortColumn, startRow, maximumRows, archiving);

            ExchangeAccountsPaged result = new ExchangeAccountsPaged();
            result.RecordsCount = (int)ds.Tables[0].Rows[0][0];

            List<ExchangeAccount> accounts = new List<ExchangeAccount>();
            ObjectUtils.FillCollectionFromDataView(accounts, ds.Tables[1].DefaultView);

            Organization org = null;
            try
            {
                org = GetOrganization(itemId);

                if (org != null)
                {
                    Organizations orgProxy = OrganizationController.GetOrganizationProxy(org.ServiceId);

                    OrganizationUser user = null;
                    string accountName = string.Empty;
                    foreach (var account in accounts)
                    {
                        accountName = OrganizationController.GetAccountName(account.AccountName);

                        user = orgProxy.GetUserGeneralSettings(accountName, org.OrganizationId);

                        account.Disabled = user.Disabled;
                        account.Locked = user.Locked;
                    }
                }
            }
            catch { }

            result.PageItems = accounts.ToArray();
            return result;
        }
        public ExchangeAccount[] GetOrganizationSecurityGroupsPaged(int itemId, string accountTypes,
            string filterColumn, string filterValue,
            int maximumRows, int startRowIndex, string sortColumn)
        {
            if (!String.IsNullOrEmpty(filterValue))
                filterValue = filterValue + "%";

            accounts = ES.Services.Organizations.GetOrganizationSecurityGroupsPaged(itemId,
                filterColumn, filterValue, sortColumn, startRowIndex, maximumRows);

            return accounts.PageItems;
        }
		public static ExchangeAccountsPaged GetAccountsPaged(int itemId, string accountTypes,
			string filterColumn, string filterValue, string sortColumn,
			int startRow, int maximumRows)
		{
			#region Demo Mode
			if (IsDemoMode)
			{
                string []parseedAccountTypes = Utils.ParseDelimitedString(accountTypes, ',');
                                                
				ExchangeAccountsPaged res = new ExchangeAccountsPaged();
                res.PageItems = GetAccounts(itemId, (ExchangeAccountType)Utils.ParseInt(parseedAccountTypes[0], 1)).ToArray();
				res.RecordsCount = res.PageItems.Length;
				return res;
			}
			#endregion

			DataSet ds = DataProvider.GetExchangeAccountsPaged(SecurityContext.User.UserId, itemId,
                accountTypes, filterColumn, filterValue, sortColumn, startRow, maximumRows);

			ExchangeAccountsPaged result = new ExchangeAccountsPaged();
			result.RecordsCount = (int)ds.Tables[0].Rows[0][0];
			
			List<ExchangeAccount> accounts = new List<ExchangeAccount>();
			ObjectUtils.FillCollectionFromDataView(accounts, ds.Tables[1].DefaultView);
			result.PageItems = accounts.ToArray();
			return result;
		}