//GET: /PolicyOnlineOtherGroupItemDataTableItem/List
        public ActionResult List(int id, int policyGroupId, string filter, int?page, string sortField, int?sortOrder)
        {
            PolicyOnlineOtherGroupItemDataTableItemsVM PolicyOnlineOtherGroupItemDataTableItemsVM = new PolicyOnlineOtherGroupItemDataTableItemsVM();

            //Check Policy Exists
            PolicyGroup policyGroup = new PolicyGroup();

            policyGroup = policyGroupRepository.GetGroup(policyGroupId);
            if (policyGroup == null)
            {
                ViewData["ActionMethod"] = "ListGet";
                return(View("RecordDoesNotExistError"));
            }

            PolicyOnlineOtherGroupItemDataTableItemsVM.PolicyGroup = policyGroup;

            //Check PolicyOtherGroupHeader Exists
            PolicyOtherGroupHeader policyOtherGroupHeader = new PolicyOtherGroupHeader();

            policyOtherGroupHeader = policyOtherGroupHeaderRepository.GetPolicyOtherGroupHeader(id);
            if (policyOtherGroupHeader == null)
            {
                ViewData["ActionMethod"] = "ListGet";
                return(View("RecordDoesNotExistError"));
            }

            PolicyOnlineOtherGroupItemDataTableItemsVM.PolicyOtherGroupHeader = policyOtherGroupHeader;

            //Set Access Rights
            PolicyOnlineOtherGroupItemDataTableItemsVM.HasWriteAccess = false;
            RolesRepository rolesRepository = new RolesRepository();

            if (rolesRepository.HasWriteAccessToPolicyGroup(policyGroupId) && rolesRepository.HasWriteAccessToPolicyOnlineOtherGroupItemRepository())
            {
                PolicyOnlineOtherGroupItemDataTableItemsVM.HasWriteAccess = true;
            }

            //SortField + SortOrder settings
            if (string.IsNullOrEmpty(sortField))
            {
                //Dynamically generated in proc
                sortField = string.Empty;
            }
            ViewData["CurrentSortField"] = sortField;

            if (sortOrder == 1)
            {
                ViewData["NewSortOrder"]     = 0;
                ViewData["CurrentSortOrder"] = 1;
            }
            else
            {
                ViewData["NewSortOrder"]     = 1;
                ViewData["CurrentSortOrder"] = 0;
            }

            DataTable PolicyOnlineOtherGroupItemDataTableItems = PolicyOnlineOtherGroupItemDataTableItemRepository.GetPolicyOnlineOtherGroupItemDataTableItems(
                id, policyGroup.PolicyGroupId, filter ?? "", sortField, sortOrder ?? 0, page ?? 1, ref PolicyOnlineOtherGroupItemDataTableItemsVM);

            PolicyOnlineOtherGroupItemDataTableItemsVM.PolicyOnlineOtherGroupItemDataTableItems = PolicyOnlineOtherGroupItemDataTableItems;

            return(View(PolicyOnlineOtherGroupItemDataTableItemsVM));
        }
        //Sortable List
        public DataTable GetPolicyOnlineOtherGroupItemDataTableItems(int id, int policyGroupId, string filter, string sortField, int sortOrder, int page, ref PolicyOnlineOtherGroupItemDataTableItemsVM PolicyOnlineOtherGroupItemDataTableItemsVM)
        {
            //query db
            string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0];

            DataSet PolicyOnlineOtherGroupItemDataTableItems = new DataSet();

            string connectionStringName = Settings.getConnectionStringName();

            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString))
            {
                using (SqlCommand cmd = new SqlCommand("spDesktopDataAdmin_SelectPolicyOnlineOtherGroupItemDataTableRows_v1", conn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@PolicyOtherGroupHeaderId", id);
                    cmd.Parameters.AddWithValue("@PolicyGroupId", policyGroupId);
                    cmd.Parameters.AddWithValue("@Filter", filter);
                    cmd.Parameters.AddWithValue("@SortField", sortField);
                    cmd.Parameters.AddWithValue("@SortOrder", sortOrder);
                    cmd.Parameters.AddWithValue("@PageNumber", page);
                    cmd.Parameters.AddWithValue("@AdminUserGuid", adminUserGuid);
                    conn.Open();

                    SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                    adapter.Fill(PolicyOnlineOtherGroupItemDataTableItems);
                }
            }

            if (PolicyOnlineOtherGroupItemDataTableItems.Tables[1] != null)
            {
                DataTable dt = PolicyOnlineOtherGroupItemDataTableItems.Tables[1];

                int totalRecords = (from DataRow dr in dt.Rows select(int) dr["Record Count"]).FirstOrDefault();
                int pageSize     = 16;

                PolicyOnlineOtherGroupItemDataTableItemsVM.PageIndex  = page;
                PolicyOnlineOtherGroupItemDataTableItemsVM.PageSize   = pageSize;
                PolicyOnlineOtherGroupItemDataTableItemsVM.TotalCount = totalRecords;
                PolicyOnlineOtherGroupItemDataTableItemsVM.TotalPages = (int)Math.Ceiling(totalRecords / (double)pageSize);
            }

            return(PolicyOnlineOtherGroupItemDataTableItems.Tables[0]);
        }