private void moveToNext(BallModel ball, IComponent currentPoint) { if (currentPoint.ComponentType == ComponentTypeEnum.Container) { var container = (currentPoint as ContainerModel); _containerService.AddBallToContainer(ball, container); } else { var endPoint = currentPoint as EndPointModel; if (endPoint.Gate.GateOpenDirection) { this.moveToNext(ball, endPoint.LeftComponent); } else { this.moveToNext(ball, endPoint.RightComponent); } _endPointService.BallThroughEndPoint(endPoint); } }