iirc last time I attempted this (relatively recently) there were issues with serializing a NamedDomainObjectContainer as part of task inputs (similar problems for BuildService or Worker inputs), ended up pulling pieces out into custom objects to work around this.