/// <summary>Save card modifications to database according to CardAction.</summary>
        /// <param name="card">Card instance</param>
        /// <param name="cardAction">The resulting card action.</param>
        /// <param name="db">Database instance</param>
        public static async Task AnswerAsync(
            this Card card, CardAction cardAction, IDatabaseAsync db)
        {
            if (db != null)
            {
                switch (cardAction)
                {
                case CardAction.Delete:
                    await db.DeleteAsync <Card>(card.Id).ConfigureAwait(false);

                    break;

                case CardAction.Update:
                    await db.UpdateAsync(card).ConfigureAwait(false);

                    break;

                default:
                    throw new InvalidOperationException(
                              "Card.Answer ended up in an invalid Card Action state.");
                }
            }
        }
        //
        // Allows to override Add/Remove behavior to add features

        /// <summary>
        ///   Removes from database.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns></returns>
        protected async Task <bool> RemoveFromDbAsync(T item)
        {
            return(await _db.DeleteAsync(item).ConfigureAwait(false) > 1);
        }