public ResponseObj AuthorizeIdentities([FromUri] string dataId, [FromBody] List <IdentityDescriptionObject> identityDescriptionObjects) { log.Info("Incoming request to " + GetCurrentMethod()); if (!FormatValidation.IsValidUvid(dataId)) { throw CreateHttpResponseException(HttpStatusCode.BadRequest, "Invalid UVID format"); } try { foreach (var identityObject in identityDescriptionObjects) { // CHeck if the identity already exists in the local identity table var identity = _identityService.Get(x => x.UID == identityObject.IdentityId).FirstOrDefault(); // If not add new identity if (identity == null) { identity = new Identity { UID = identityObject.IdentityId, Name = identityObject.IdentityName }; _identityService.Insert(identity); } ; // Get ACL for identity and messageID var current = _aclObjectService.Get(x => x.MessageID == dataId && x.Subscriber.ID == identity.ID).FirstOrDefault(); // If not already exists add new ACL if (current == null) { var acl = new ACLObject(); acl.MessageID = dataId; acl.LastUpdateTime = DateTime.UtcNow; acl.Subscriber = identity; _aclObjectService.Insert(acl); } log.Info(string.Format("ACL added for identity {0} on messageId {1}", identity.Name, dataId)); } SetLastInteractionTime(); // Save to DB _context.SaveChanges(); // Create response return(new ResponseObj(dataId)); } catch (HttpResponseException ex) { log.Error(ex.Message, ex); throw; } catch (Exception ex) { log.Error(ex.Message, ex); string msg = "VIS internal server error. " + ex.Message; throw CreateHttpResponseException(HttpStatusCode.InternalServerError, msg); } }