public ActionResult AddFiles([FromBody] ICollection <Medium> files, int channelId) { var tokenEntry = _tokenManager.ValidateAndReturnTokenEntry(_tokenManager.ExtractToken(Request)); if (tokenEntry != null) { var currEvent = _dbContext.Events.Where(x => x.ChannelId == channelId).FirstOrDefault(); if (currEvent != null) { var rosterEntry = _dbContext.EventRosterEntries.Where(x => x.EventId == currEvent.EventId && x.AttendeeId == tokenEntry.UserId).FirstOrDefault(); if (rosterEntry != null && tokenEntry.UserId != currEvent.EventOrganiserId) { _fileManager.AddFilesToChannel(files, channelId, currEvent.EventId, tokenEntry.UserId); return(Ok()); } return(BadRequest("User is not registered for event")); } return(BadRequest("Event is not valid")); } return(StatusCode(401, SystemResources.INVALID_TOKEN_MESSAGE)); }