protected void UpdateSelectedFlag(ItemsList itemsList) { foreach (ListItem item in itemsList) { object layout; object size; if (item.AdditionalProperties.TryGetValue(Consts.KEY_LAYOUT_TYPE, out layout) && item.AdditionalProperties.TryGetValue(Consts.KEY_LAYOUT_SIZE, out size)) { item.Selected = LayoutType.Equals(layout) && LayoutSize.Equals(size); } } }