diff --git a/src/Altinn.App.Core/Models/Layout/Components/GridComponent.cs b/src/Altinn.App.Core/Models/Layout/Components/GridComponent.cs
index 4315f36e4..ba461eebd 100644
--- a/src/Altinn.App.Core/Models/Layout/Components/GridComponent.cs
+++ b/src/Altinn.App.Core/Models/Layout/Components/GridComponent.cs
@@ -53,28 +53,12 @@ public class GridCell
///
public List Children()
{
- List gridChildren = new List();
-
- if (this.Rows is null)
- {
- return gridChildren;
- }
-
- foreach (var row in this.Rows)
- {
- if (row.Cells is null)
- {
- continue;
- }
-
- foreach (var cell in row.Cells)
- {
- if (cell.ComponentId is not null)
- {
- gridChildren.Add(cell.ComponentId);
- }
- }
- }
- return gridChildren;
+ return this.Rows?
+ .Where(r => r.Cells is not null)
+ .SelectMany(r => r.Cells!)
+ .Where(c => c.ComponentId is not null)
+ .Select(c => c.ComponentId!)
+ .ToList()
+ ?? new List();
}
}