private void RemoveLeakingCells( ICollection<Cell> aliveCells, UIElementCollection collection )
    {
      if( ( aliveCells == null ) || ( collection == null ) )
        return;

      //Remove the inaccessible cells from the elements collection.
      for( int i = collection.Count - 1; i >= 0; i-- )
      {
        Cell cell = collection[ i ] as Cell;

        if( ( cell != null ) && ( !aliveCells.Contains( cell ) ) )
        {
          collection.RemoveAt( i );
        }
      }
    }