public async Task <AnnotationContract> PostAsync(AnnotationContract annotation) { try { _telemetryClient.TrackEvent("AnnotationController PostAsync invoked"); await ValidateAndReturnCurrentUserId(); // Get the Gold gifting user. var fromUser = await _repository.GetUser(annotation.From.UserId); // Check to see if the gifting user has enough of a balance to support gift. if ((fromUser.GoldBalance - annotation.GoldCount) < 0) { throw ServiceExceptions.UserBalanceTooLow(); } var insertedAnnotation = await _repository.InsertAnnotation(annotation); var photoContract = await _repository.GetPhoto(annotation.PhotoId); try { _telemetryClient.TrackEvent("Gold received Push notification invoked."); // Send push notification to the user receiving Gold await _notificationHandler.PushGoldReceivedNotificationAsync(PushNotificationPlatform.Windows, "user:"******"You have received GOLD!", photoContract.ThumbnailUrl, annotation.PhotoId); } catch (Exception e) { _telemetryClient.TrackException(e); } return(insertedAnnotation); } catch (DataLayerException ex) { _telemetryClient.TrackException(ex); if (ex.Error == DataLayerError.Unknown) { throw ServiceExceptions.UnknownInternalFailureException(ServiceExceptions.Source); } throw ServiceExceptions.DataLayerException(ex.Message); } }