public Result <ContaPreview> ObterPreview(ObterPreviewQuery query) { try { var result = query.Validate(); if (result.IsFailure) { return(Result.Fail <ContaPreview>(result.Errors)); } var queryResult = _repository.ObterPreview(result.Value); if (queryResult.HasValue) { return(Result.Ok(queryResult.Value)); } return(Result.Ok <ContaPreview>(null)); } catch (Exception ex) { return(Result.Fail <ContaPreview>("Falha ao obter preview da conta")); } }