public async Task <HttpResponseMessage> AddTechInterview(HttpRequestMessage request, [FromBody] TechInterviewInDTO value) { try { var userId = ContextParser.GetUserId(request.GetRequestContext()); var interview = Mapper.Map <TechInterviewInDTO, TechInterview>(value); interview.HRM = userId; var createdInterview = await interviewService.AddTechInterview(interview); var e = await eventService.RegisterTechInterview(createdInterview, userId); unitOfWork.Save(); if (createdInterview.Interviewer.HasValue) { var notification = await notificationService.CreateNotification(createdInterview.Interviewer.Value, NotificationTypes.Interview, new List <Event> { e }); if (NotificationsHub.IsConnected(createdInterview.Interviewer.Value)) { await NotificationsHub.PushNotification(notification); } } unitOfWork.Save(); return(request.CreateResponse(HttpStatusCode.OK)); } catch (Exception ex) { logger.Error(ex, JsonConvert.SerializeObject(value)); return(request.CreateResponse(HttpStatusCode.InternalServerError)); } }