public async Task <IActionResult> AddBuildToChannel(int channelId, int buildId)
        {
            Data.Models.Channel channel = await _context.Channels.FindAsync(channelId);

            if (channel == null)
            {
                return(NotFound(new ApiError($"The channel with id '{channelId}' was not found.")));
            }

            Build build = await _context.Builds.FindAsync(buildId);

            if (build == null)
            {
                return(NotFound(new ApiError($"The build with id '{buildId}' was not found.")));
            }

            // If build is already in channel, nothing to do
            if (build.BuildChannels != null &&
                build.BuildChannels.Any(existingBuildChannels => existingBuildChannels.ChannelId == channelId))
            {
                return(StatusCode((int)HttpStatusCode.Created));
            }

            var buildChannel = new BuildChannel
            {
                Channel = channel,
                Build   = build
            };
            await _context.BuildChannels.AddAsync(buildChannel);

            await _context.SaveChangesAsync();

            return(StatusCode((int)HttpStatusCode.Created));
        }
        public override async Task <IActionResult> AddBuildToChannel(int channelId, int buildId)
        {
            Data.Models.Channel channel = await _context.Channels.FindAsync(channelId);

            if (channel == null)
            {
                return(NotFound(new ApiError($"The channel with id '{channelId}' was not found.")));
            }

            Build build = await _context.Builds
                          .Where(b => b.Id == buildId)
                          .Include(b => b.BuildChannels)
                          .FirstOrDefaultAsync();

            if (build == null)
            {
                return(NotFound(new ApiError($"The build with id '{buildId}' was not found.")));
            }

            // If build is already in channel, nothing to do
            if (build.BuildChannels.Any(existingBuildChannels => existingBuildChannels.ChannelId == channelId))
            {
                return(StatusCode((int)HttpStatusCode.Created));
            }

            var buildChannel = new BuildChannel
            {
                Channel       = channel,
                Build         = build,
                DateTimeAdded = DateTimeOffset.UtcNow
            };
            await _context.BuildChannels.AddAsync(buildChannel);

            await _context.SaveChangesAsync();

            return(StatusCode((int)HttpStatusCode.Created));
        }