public async Task <ICourse> GetCourseById(Guid id) { if (id == Guid.Empty) { throw new ArgumentException($"Cannot be an empty {nameof(Guid)}", nameof(id)); } Course persisted = null; using (var client = _cosmosDbHelper.GetClient()) { var doc = await _cosmosDbHelper.GetDocumentByIdAsync(client, _settings.CoursesCollectionId, id); persisted = _cosmosDbHelper.DocumentTo <Course>(doc); } return(persisted); }