public ICommandResult Handle(AddAddressCommand command) { command.Validate(); if (command.Invalid) { AddNotifications(command); return(new CommandResult(false, "Erro ao adicionar", Notifications)); } var student = _studentRepository.GetById(command.StudentID); var address = new Address ( command.ZipCode, command.Street, command.Number, command.Neighborhood, command.City, command.State, command.PhoneNumber, command.CellPhoneNumber ); student.AddAddress(address); AddNotifications(student, address); if (Invalid) { return(new CommandResult(false, "Erro ao adicionar.", Notifications)); } _studentRepository.AddAddress(student.Id, address); return(new CommandResult(true, "Dados cadastrados com sucesso", Notifications)); }