public Optional<BoardTileModel> placeTileModel(
     GridModel.GridPosition gridPosition, ConveyorTileModel conveyorTileModel) {
   if (cannotPlaceTileAtPosition(gridPosition)) return Optional.absent();
   BoardTileModel boardTileModel = boardTileModelFactory.createTileModel(conveyorTileModel);
   gridModel.set(gridPosition, boardTileModel);
   return Optional.of(boardTileModel);
 }
  public void placeSourceAndSink() {
    GridModel.GridPosition gridPosition =
        new GridModel.GridPosition(random.nextInt(numRows), random.nextInt(numCols));
    sourceTileModel = boardTileModelFactory.createTileModel(BoardTileType.START_PIPE);
    boolean placedSource = placeTileModel(gridPosition, sourceTileModel);

    boolean placedSink;
    do {
      gridPosition = new GridModel.GridPosition(random.nextInt(numRows), random.nextInt(numCols));
      sinkTileModel = boardTileModelFactory.createTileModel(BoardTileType.END_PIPE);
      placedSink = placeTileModel(gridPosition, sinkTileModel);
    } while (!placedSink);

    try {
      rotateTile(sourceTileModel);
      rotateTile(sinkTileModel);
    } catch (GridPositionOutOfBoundsException e) {
      // Do nothing
      // There may be exceptions due to the tile being adjacent
      // to an edge and facing towards it, that's why we're rotating it.
    }
  }