public async Task<bool> CreateTransaction(NewTransactionViewModel model)
        {
            // Get the authenticated user
            var username = HttpContext.Current.User.Identity.Name;
            User user = await _userManager.FindByNameAsync(username);

            // First retrieve all categories.
            // Select the category specified by submitted transaction data.
            // If no such category exists, create it and get the category id.
            IList<Category> categories = await _accountData.GetCategoriesAsync();
            Category category = categories.FirstOrDefault(c => c.Name == model.Category);
            int categoryId;
            if (category == null)
                categoryId = await _accountData.InsertCategoryAsync(new Category
                {
                    Name = model.Category
                });
            else
                categoryId = category.Id;


            // Insert New Transaction
            Transaction transaction = new Transaction
            {
                AccountId = model.AccountId,
                Description = model.Description,
                Amount = model.Amount,
                Reconciled = model.Reconciled,
                isReconciled = model.Amount.Equals(model.Reconciled),
                TransactionDate = model.TransactionDate,
                Updated_By = user.Id
            };
            int transactionId = await _accountData.InsertTransactionAsync(transaction);

            // Insert entry in the TransactionCategories join table
            // to associate the newly created transaction with it's category
            bool result = await _accountData.InsertTransactionCategoryAsync(transactionId, categoryId);

            return result;
        }
        public async Task<IList<TransactionViewModel>> CreateTransaction(NewTransactionViewModel model)
        {
            bool result = await AccountManager.CreateTransaction(model);
            if (!result)
                throw new HttpResponseException(HttpStatusCode.InternalServerError);

            IList<TransactionViewModel> transactions = await AccountManager.GetTransactions(model.AccountId);

            return transactions;
        }