public Card OpenNewCard(string shortCardName, Currency currency, CardType cardType) { if (cardType == CardType.UNKNOWN) { throw new UserDataException("Wrong type card", cardType.ToString()); } IList <Card> allCards = GetCards().ToList(); var cardNumber = _businessLogicService.GenerateNewCardNumber(cardType); _businessLogicService.ValidateCardExist(allCards, shortCardName, cardNumber); var newCard = new Card { CardNumber = cardNumber, CardName = shortCardName, Currency = currency, CardType = cardType }; _cardRepository.Add(newCard); _cardRepository.Save(); var transaction = _businessLogicService.AddBonusOnOpen(newCard); _transactionRepository.Add(transaction); _transactionRepository.Save(); return(newCard); }