public MediatorResponse <ContactMessageViewModel> SendContactMessage(Guid?candidateId, ContactMessageViewModel contactMessageViewModel) { var validationResult = _contactMessageServerViewModelValidator.Validate(contactMessageViewModel); if (!validationResult.IsValid) { PopulateContactMessageViewModelEnquiries(contactMessageViewModel); return(GetMediatorResponse(HomeMediatorCodes.SendContactMessage.ValidationError, contactMessageViewModel, validationResult)); } if (_candidateServiceProvider.SendContactMessage(candidateId, contactMessageViewModel)) { var viewModel = InternalGetContactMessageViewModel(candidateId); PopulateContactMessageViewModelEnquiries(viewModel); return(GetMediatorResponse(HomeMediatorCodes.SendContactMessage.SuccessfullySent, viewModel, ApplicationPageMessages.SendContactMessageSucceeded, UserMessageLevel.Success)); } PopulateContactMessageViewModelEnquiries(contactMessageViewModel); return(GetMediatorResponse(HomeMediatorCodes.SendContactMessage.Error, contactMessageViewModel, ApplicationPageMessages.SendContactMessageFailed, UserMessageLevel.Warning)); }