public GridLocation GetGridLocation(GridModel grid) { var index = Grids.IndexOf(grid); int x = index % Width; int y = (index + Width - 1) / Width; return(new GridLocation(x, y)); }