private DeviceDto ConvertToDto(Device entity) { if (entity == null) { return(null); } return(new DeviceDto { Id = entity.Id, Year = entity.Year, DeviceType = entity.Type, DeviceName = entity.Name, DeviceModel = entity.DeviceModel, DeviceManufacturer = entity.Manufacturer, SerialNumber = entity.SerialNumber, Created = entity.Created, CreatedBy = entity.CreatedBy, Modified = entity.Modified, ModifiedBy = entity.ModifiedBy, Checkout = _checkoutService.GetByDeviceIdAsync(entity.Id).GetAwaiter().GetResult(), CheckoutsHistory = _checkoutService.GetDeviceHistoryByIdAsync(entity.Id).GetAwaiter().GetResult() }); }