/// <summary>
        /// Gets all DSeries objects from the database.
        /// </summary>
        /// <param name="command">Command containing the get all query.</param>
        /// <returns>All dseries from the database.</returns>
        private IEnumerable <DSeries> ToDSeriesList(IDbCommand command)
        {
            using (var reader = command.ExecuteReader())
            {
                List <DSeries> items = new List <DSeries>();
                while (reader.Read())
                {
                    var item = new DSeries();
                    Map(reader, item);
                    items.Add(item);
                }

                return(items);
            }
        }
        /// <summary>
        /// Adds a DSeries to the database.
        /// </summary>
        /// <param name="dComic">DComic with series to add.</param>
        private void AddDSeries(DSeries dSeries)
        {
            using (var command = context.CreateCommand())
            {
                command.CommandText = @"Select * From Series Where Series.name = @name";
                command.AddParameter("name", dSeries.Name);
                int?id = (int?)command.ExecuteScalar();

                if (id != null)
                {
                    dSeries.Id = (int)id;
                }
                else
                {
                    command.CommandText = @"Insert into Series (Name) " +
                                          "values (@name)" +
                                          "SELECT CAST(scope_identity() AS int);";
                    dSeries.Id = (int)command.ExecuteScalar();
                }
            }
        }
 /// <summary>
 /// Maps a record to a DSeries object.
 /// </summary>
 /// <param name="record">Record to bind.</param>
 /// <param name="dSeries">Comic to bind to.</param>
 private void Map(IDataRecord record, DSeries dSeries)
 {
     dSeries.Id   = (int)record["ID"];
     dSeries.Name = (string)record["Name"];
 }