public Task<Transaction> PostTransaction(Transaction transaction)
        {
            if (transaction != null)
                transactions.Add(transaction);

            return Task.Run<Transaction>(() => transaction);
        }
        public async Task<Transaction> PostTransaction(Transaction transaction)
        {
            if (transaction != null)
            {
                db.Transactions.Add(transaction);
                await db.SaveChangesAsync();
            }

            return transaction;
        }
        public async Task<IHttpActionResult> PostTransaction(Transaction transaction)
        {
            if (transaction == null || !ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            transaction = await transactionRepository.PostTransaction(transaction);

            return CreatedAtRoute("DefaultApi", new { id = transaction.TransactionId }, transaction);
        }
        public async Task<IHttpActionResult> PutTransaction(long id, Transaction transaction)
        {
            if (transaction == null || !ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != transaction.TransactionId)
            {
                return BadRequest();
            }

            if (await transactionRepository.PutTransaction(id, transaction))
                return StatusCode(HttpStatusCode.NoContent);
            else
                return NotFound();
        }
        public Task<bool> PutTransaction(long id, Transaction transaction)
        {
            bool result;

            int index = transactions.FindIndex((t) => t.TransactionId == id);

            if (index == -1)
                result = false;
            else
            {
                transactions.RemoveAt(index);
                transactions.Insert(index, transaction);

                result = true;
            }

            return Task.Run<bool>(() => result);
        }
        public async Task<bool> PutTransaction(long id, Transaction transaction)
        {
            db.Entry(transaction).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TransactionExists(id))
                {
                    return false;
                }
                else
                {
                    throw;
                }
            }

            return true;
        }