public async Task AddToCart(string cartId, Album album, CancellationToken cancellationToken = default(CancellationToken))
        {
            Serilog.Log.Logger.Debug($"{nameof(this.AddToCart)} album '{album.Title}' for cart with id '{cartId}'");
            using (var dbContext = this._dbContextFactory.Create())
            {
                // Get the matching cart and album instances
                var cartItem =
                    await
                        dbContext.CartItems.SingleOrDefaultAsync(
                            c => c.CartId == cartId && c.AlbumId == album.AlbumId,
                            cancellationToken);

                if (cartItem == null)
                {
                    // Create a new cart item if no cart item exists
                    cartItem = new CartItem
                    {
                        AlbumId = album.AlbumId,
                        CartId = cartId,
                        Count = 1,
                        DateCreated = DateTime.Now
                    };

                    dbContext.CartItems.Add(cartItem);
                }
                else
                {
                    // If the item does exist in the cart, then add one to the quantity
                    cartItem.Count++;
                }

                await dbContext.SaveChangesAsync(cancellationToken);
            }
        }
 private Album CreateTestAlbum(Genre genre, string name = null)
 {
     var autofixture = new Ploeh.AutoFixture.Fixture();
     var album =
         new Album
         {
             Price = 12,
             Title = name ?? Guid.NewGuid().ToString(),
             Genre = genre,
             Artist =
                 new Artist
                 {
                     Name = Guid.NewGuid().ToString()
                 },
             Created = DateTime.UtcNow
         };
     return album;
 }