public MessageDataDto GetByMessageId(Guid messageId) { var specification = new Specification <MessageData>(x => x.MessageId.Equals(messageId)); var messageData = _repository.GetBySpecification(specification).SingleOrDefault(); if (messageData == default(MessageData)) { return(default(MessageDataDto)); } return(MessageDataDto.FromEntity(messageData)); }