public void DisallowNullNames()
 {
     using (SoundboardServiceContext context =
         new SoundboardServiceContext())
     {
         Channel nullNameChannel = new Channel()
         {
             Name = null
         };
         context.Channels.Add(nullNameChannel);
         context.SaveChanges();
     }
 }
		public async Task<IHttpActionResult> PostChannel(Channel channel)
		{
			if (!this.ModelState.IsValid)
				return BadRequest(this.ModelState);

			// TODO: Check if channel name already exists.
			if (ChannelExists(channel.Name))
				return Content(HttpStatusCode.Conflict, "Channel by that name already exists.");

			this.db.Channels.Add(channel);
			await this.db.SaveChangesAsync();

			return CreatedAtRoute("DefaultApi", new {id = channel.Id}, channel);
		}
		public async Task<IHttpActionResult> PutChannel(string name, Channel channel)
		{
			if (!this.ModelState.IsValid)
				return BadRequest(this.ModelState);

			if (name.ToLower() != channel.Name.ToLower())
				return BadRequest();

			this.db.Entry(channel).State = EntityState.Modified;

			try
			{
				await this.db.SaveChangesAsync();
			}
			catch (DbUpdateConcurrencyException)
			{
				if (!ChannelExists(name))
					return NotFound();
				else
					throw;
			}

			return StatusCode(HttpStatusCode.NoContent);
		}