private async Task ConnectToNeihbours(Tile tile) { var neighbourTop = await _tileRepository.GetTileAt(tile.BoardId, tile.X, tile.Y - 1); var neighbourRight = await _tileRepository.GetTileAt(tile.BoardId, tile.X + 1, tile.Y); var neighbourBottom = await _tileRepository.GetTileAt(tile.BoardId, tile.X, tile.Y + 1); var neighbourLeft = await _tileRepository.GetTileAt(tile.BoardId, tile.X - 1, tile.Y); if (neighbourTop != null) { await ConnectComponents(TilePosition.Top, tile, neighbourTop); } if (neighbourRight != null) { await ConnectComponents(TilePosition.Right, tile, neighbourRight); } if (neighbourBottom != null) { await ConnectComponents(TilePosition.Bottom, tile, neighbourBottom); } if (neighbourLeft != null) { await ConnectComponents(TilePosition.Left, tile, neighbourLeft); } }