public async Task <bool> AddResumenCVToCandidatoAsync(int idCandidato, Candidato candidato)
        {
            var especificacion = new CandidatoSpecification(idCandidato);
            var toEdit         = await this.candidatoRepository.Single(especificacion)
                                 .ConfigureAwait(false);

            if (toEdit == null)
            {
                return(false);
            }

            if (candidato != null)
            {
                if (toEdit.CandidatoDetalle != null)
                {
                    if (toEdit.CandidatoDetalle.UltimoTrabajo == null)
                    {
                        toEdit.CandidatoDetalle.UltimoTrabajo = new UltimoTrabajo();
                    }
                    else
                    {
                        var puestoSolicitado = toEdit.CandidatoDetalle.UltimoTrabajo;

                        puestoSolicitado.Empresa = candidato?.CandidatoDetalle?.UltimoTrabajo?.Empresa;
                        puestoSolicitado.Puesto  = candidato?.CandidatoDetalle?.UltimoTrabajo.Puesto;
                    }

                    toEdit.CandidatoDetalle.Certificacion       = candidato.CandidatoDetalle.Certificacion;
                    toEdit.CandidatoDetalle.PretencionEconomica = candidato.CandidatoDetalle.PretencionEconomica;
                    toEdit.CandidatoDetalle.UltimoSalarioId     = candidato.CandidatoDetalle.UltimoSalarioId;
                    toEdit.CandidatoDetalle.Experiencia         = candidato.CandidatoDetalle.Experiencia;
                    //toEdit.CandidatoDetalle.PuestoSolicitadoId = candidato.CandidatoDetalle.PuestoSolicitado?.Id;

                    await this.candidatoRepository.UpdateAsync(toEdit);

                    return(true);
                }
            }

            return(false);
        }
        public async Task <Candidato> UpdateCandidatoAsync(int idCandidato, Candidato candidato)
        {
            var detalle = candidato.CandidatoDetalle;

            // if (candidato.CandidatoDetalle.StatusCapturaInformacion == EStatusCapturaCandidato.CandidatoNuevo)
            // {
            // candidato.CandidatoDetalle.StatusCapturaInformacion = EStatusCapturaCandidato.NotificarCapturaInicial;
            // }
            if (detalle != null)
            {
                detalle.CandidatoId = candidato.Id;

                if (detalle.Id == 0)
                {
                    await this.candidatoDetalleAsyncRepository.AddAsync(detalle)
                    .ConfigureAwait(false);
                }
                else
                {
                    if (detalle.Direccion != null)
                    {
                        if (detalle.Direccion.Id == 0)
                        {
                            detalle.Direccion.CandidatoDetalleId = detalle.Id;
                            await this.direccionRepository.AddAsync(detalle.Direccion)
                            .ConfigureAwait(false);
                        }
                        else
                        {
                            await this.direccionRepository.UpdateAsync(detalle.Direccion)
                            .ConfigureAwait(false);
                        }
                    }

                    detalle.EstadoCivilId = candidato.CandidatoDetalle.EstadoCivilId;

                    if (detalle.UltimoTrabajo != null)
                    {
                        if (detalle.UltimoTrabajo.Id == 0)
                        {
                            await this.ultimoTrabajoRepository.AddAsync(detalle.UltimoTrabajo)
                            .ConfigureAwait(false);
                        }
                        else
                        {
                            await this.ApplyChangesUltimoTrabajoIngresos(
                                detalle.UltimoTrabajo.Ingresos,
                                detalle.UltimoTrabajo)
                            .ConfigureAwait(false);

                            await this.ApplyChangesUltimoTrabajoPrestaciones(
                                detalle.UltimoTrabajo.Prestaciones,
                                detalle.UltimoTrabajo)
                            .ConfigureAwait(false);

                            await this.ultimoTrabajoRepository.UpdateAsync(detalle.UltimoTrabajo)
                            .ConfigureAwait(false);

                            await this.candidatoDetalleAsyncRepository.UpdateAsync(detalle)
                            .ConfigureAwait(false);
                        }
                    }

                    await this.ApplyChangesReferenciasLaborales(detalle.ReferenciasLaborales)
                    .ConfigureAwait(false);

                    await this.ApplyChangesReferenciasPersonales(detalle.ReferenciasPersonales)
                    .ConfigureAwait(false);

                    await this.candidatoDetalleAsyncRepository.UpdateAsync(detalle)
                    .ConfigureAwait(false);
                }
            }

            await this.candidatoRepository.UpdateAsync(candidato)
            .ConfigureAwait(false);

            var especificacion = new CandidatoSpecification(idCandidato);
            var result         = await this.candidatoRepository.ListAsync(especificacion)
                                 .ConfigureAwait(false);

            return(result.FirstOrDefault());
        }