// GET api/chunkapi/5
        public Models.ChunksModel Get(int workerID)
        {
            var workerBL = new BL.Worker();
            var worker = workerBL.Get(workerID);
            Debug.Assert( worker.ID == workerID );

            var chunkBL = new BL.Chunk();
            var chunks = chunkBL.GetByWorker(worker);

            var ret = Models.ChunksModel.Create(worker.ID, worker.Name,
                chunks.Select( c => Models.ChunkModel.Create( c, worker.ID )).ToList()
                );

            return ret;
        }
        private static void ManipulateChunk(BL.DTO.Worker worker)
        {
            Console.WriteLine("Commencing Chunks");
            var chunkBL = new BL.Chunk();

            var chunk1 = chunkBL.Add(DateTimeOffset.Now, DateTimeOffset.Now.AddMinutes(30), TimeSpan.Zero, worker.ID);
            Console.WriteLine(string.Format("Chunk.ID {0} for Worker.ID{1} has been created with start:{2} and stop:{3} and duration:{4}.", chunk1.ID, worker.ID, chunk1.Start, chunk1.Stop, chunk1.Duration));
            var chunk2 = chunkBL.Add(DateTimeOffset.Now, DateTimeOffset.Now.AddMinutes(30), new TimeSpan( 0,30,0), worker.ID);
            Console.WriteLine(string.Format("Chunk.ID {0} for Worker.ID{1} has been created with start:{2} and stop:{3} and duration:{4}.", chunk2.ID, worker.ID, chunk2.Start, chunk2.Stop, chunk2.Duration));

            Console.WriteLine("Getting what we have created.");
            var chunk3 = chunkBL.Get(chunk2.ID);
            Debug.Assert(chunk2.ID == chunk3.ID );
            Debug.Assert(chunk2.Start == chunk3.Start);
            Debug.Assert(chunk2.Stop == chunk3.Stop);
            Debug.Assert(chunk2.Duration == chunk3.Duration);

            Console.WriteLine(string.Format("Updating Chunk.ID:{0} with 20 minutes more.", chunk2.ID));
            chunk2.Stop += new TimeSpan(0, 20, 0);
            chunk2.Duration += new TimeSpan(0, 20, 0);
            chunk2 = chunkBL.Update(chunk2);
            Console.WriteLine(string.Format("Resulted in Stop:{0} and Duration:{1}", chunk2.Stop, chunk2.Duration));

            Console.WriteLine(string.Format("Deleting Chunk with ID:{0}:", chunk2.ID));
            chunkBL.Delete(chunk2);
            var exceptionThrown = false;
            try
            {
                var x = chunkBL.Get(chunk2.ID);
            }
            catch (NullReferenceException)
            {
                exceptionThrown = true;
                Console.WriteLine( "An exception was thrown since we tried to retrieve a Chunk that was deleted.");
            }

            Console.Write(string.Format("Getting all Chunks for a Worker with id={0}.", worker.ID));
            var chunks = chunkBL.GetByWorker(worker);
            foreach (var c in chunks)
            {
                Console.WriteLine(string.Format("Chunk:{0} {1}-{2} {3}", c.ID, c.Start, c.Stop, c.Duration));
            }
            Debug.Assert(exceptionThrown);
        }