public void Create(CustomerModel customer, ShoppingCartModel shoppingCartModel, List <CartItemModel> cartItemModel) { if (!customerVal.isCustomerNew(customer, GetAllCustomers())) { var CustomerID = customer.GeneratedID(); var CartID = customer.GeneratedID(); var _dto = new DTOCustomer() { CustomerID = CustomerID, Name = customer.Name, Adress = customer.Adress, Email = customer.Email }; customer.CreateCart(shoppingCartModel, CustomerID, CartID); foreach (var item in cartItemModel) { var model = new CartItemModel(CartID, item.DrinkID, item.Quantity); cartColl.Create(model, CartID); } CustomerFactory.customerConnectionHandler.CreateCustomer(_dto); } else { var CartID = customer.GeneratedID(); var existingCustomer = customerVal.getExistingCustomer(customer.Email, GetAllCustomers()); var CustomerID = existingCustomer.First().CustomerID; customer.CreateCart(shoppingCartModel, CustomerID, CartID); foreach (var item in cartItemModel) { var model = new CartItemModel(CartID, item.DrinkID, item.Quantity); cartColl.Create(model, CartID); } } }