public synchronized List<Product> buyProduct(Client client,
			Product product, int quantityOfProductsToBuy) {
		
		if (client != null
				&& listOfPurchaseOfAllCustomers.get(client) != null
				&& product.getQuantity() >= quantityOfProductsToBuy) { /* if there is already a list*/
			
			List<Product> listAux = listOfPurchaseOfAllCustomers.get(client);
			listAux.add(product);
			listOfPurchaseOfAllCustomers.put(client, listAux);
			product.setQuantity(product.getQuantity() - quantityOfProductsToBuy);
			productManager.editProduct(product);
			logger.info("successfully performed buy");
			return listOfPurchaseOfAllCustomers.get(client);
			
		} else if (client != null
				&& listOfPurchaseOfAllCustomers.get(client) == null) {/* if the list does not exist*/
			List<Product> listAux = new LinkedList<Product>();
			listAux.add(product);
			listOfPurchaseOfAllCustomers.put(client, listAux);
			product.setQuantity(product.getQuantity() - quantityOfProductsToBuy);
			productManager.editProduct(product);
			return listOfPurchaseOfAllCustomers.get(client);
		}
		return null;
	}