public void AddArticle(Guid?basketId, Guid articleId) { Basket basket = null; var article = _articleRepository.Find(articleId); try { if (basketId == null) { basket = _basketRepository.GetBasket(); } else { basket = _basketRepository.Find((Guid)basketId); } basket.AddArticle(article); } catch (EntityNotFoundException entity) { _basketRepository.Save(new Basket(new List <Article>() { article })); } }