public Reply Send(RegularMessageToUpload message) { if (string.IsNullOrEmpty(message.Base64Content)) { return(new Reply(HttpStatusCode.BadRequest, "Message content is required")); } try { _sessionService.Validate(message.UserId, message.SessionToken); } catch (InvalidSessionException) { return(new Reply(HttpStatusCode.BadRequest, "Invalid session")); } _fileService.SaveFile(message.UserId, message.FileName, message.Base64Content); var messages = _messageService.Save(message.FileName, message.UserId, message.ReceiverIds); _pushNotificationService.SendMessagePush(message.UserId, message.ReceiverIds, messages); return(new SendMessageReply(HttpStatusCode.OK, message.FileName) { MessageIds = messages.Select(x => x.MessageId) }); }