public async Task <Presentation> SavePresentationAsync(Presentation presentation) { // Validate the fields if (presentation == null) { throw new ArgumentNullException(nameof(presentation), "The presentation can not be null"); } if (presentation.PresentationId < 0) { throw new ArgumentOutOfRangeException(nameof(presentation), "The presentation id can not be less than 0"); } if (string.IsNullOrEmpty(presentation.Title)) { throw new ArgumentNullException(nameof(presentation.Title), "The Title of the presentation can not be null"); } if (string.IsNullOrEmpty(presentation.Abstract)) { throw new ArgumentNullException(nameof(presentation.Abstract), "The Abstract of the presentation can not be null"); } var savedPresentation = await _presentationRepository.SavePresentationAsync(presentation); var addedPresentationMessage = new Domain.Models.Messages.Presentations.Added { PresentationId = savedPresentation.PresentationId }; await _presentationAddedQueue.AddMessageAsync(addedPresentationMessage); return(savedPresentation); }