public virtual Account CreateAccount(string userName, string passowrd, AccountType type)
        {
            var     hashed_password = SecurePasswordHasherHelper.Hash(passowrd);
            Account account;

            switch (type)
            {
            case AccountType.Librarian:
                account = accountFactory.CreateLibrarian(userName, hashed_password);

                var accountLibrarianAvailable = dbContext.AccountsOldData
                                                .Where(uName => uName.UserName == userName)
                                                .Select(u => new
                {
                    u.UserName
                });
                if (accountLibrarianAvailable.Count() == 0)
                {
                    dbContext.AccountsOldData.Add(account);
                    dbContext.SaveChanges();
                }
                else
                {
                    Console.WriteLine($"Account with the following username: {userName} exists");
                    Console.ReadKey();
                }

                return(account);

            case AccountType.Member:
                account = accountFactory.CreateMember(userName, hashed_password);

                var accountMemberAvailable = dbContext.AccountsOldData
                                             .Where(uName => uName.UserName == userName)
                                             .Select(u => new
                {
                    u.UserName
                });
                if (accountMemberAvailable.Count() == 0)
                {
                    dbContext.AccountsOldData.Add(account);
                    dbContext.SaveChanges();
                }
                else
                {
                    Console.WriteLine($"Account with the following username: {userName}exists");
                    Console.ReadKey();
                }
                dbContext.SaveChanges();
                return(account);

            default:
                throw new InvalidOperationException("Does not support account type");
            }
        }