class PortfolioController {

	@RequestMapping(value = "/portfolio", method = RequestMethod.POST)
	public ResponseEntity<Order> addOrder(@RequestBody final Order order) {
		logger.debug("Adding Order: " + order);
		
		//TODO: can do a test to ensure userId == order.getUserId();
		
		Order savedOrder = service.addOrder(order);

		logger.debug("Order added: " + savedOrder);
		if (savedOrder != null && savedOrder.getOrderId() != null) {
			return new ResponseEntity<Order>(savedOrder, getNoCacheHeaders(), HttpStatus.CREATED);
		} else {
			logger.warn("Order not saved: " + order);
			return new ResponseEntity<Order>(savedOrder, getNoCacheHeaders(), HttpStatus.INTERNAL_SERVER_ERROR);
		}
	}

}