public void Create(AccountDto entity)
        {
            var account = entity.ToAccount();

            account.AccountType = context.Set <AccountType>().Single(at => at.Name == entity.AccountType);
            context.Set <Account>().Add(account);
            context.SaveChanges();
        }
        public void Update(AccountDto account)
        {
            if (account == null)
            {
                throw new ArgumentNullException($"{nameof(account)} can't be null");
            }

            using (var db = new AccountContext())
            {
                Account a = db.Accounts.FirstOrDefault(x => x.Number == account.Number);

                if (a == null)
                {
                    return;
                }

                a = account.ToAccount();
                db.SaveChanges();
            }
        }
        public void Create(AccountDto account)
        {
            if (account == null)
            {
                throw new ArgumentNullException($"{nameof(account)} can't be null");
            }

            Console.WriteLine(account.Name);

            Owner owner = account.ToOwner();

            Console.WriteLine($"Owner name: {owner.Name}");
            Account addedAccount = account.ToAccount(owner);

            Console.WriteLine($"In account owner name: {addedAccount.Owner.Name}");

            using (var db = new AccountContext())
            {
                db.Owners.Add(owner);
                db.Accounts.Add(addedAccount);
                db.SaveChanges();
            }
        }