NoProperty Validation Error while changeing Agent Login

I am writing application based on Java Configuration SDK (7.6) which has to synchronize structure of Persons folder with external database.
Were two tasks of synchronization:

  • update data of agent (firstname, lastname etc.)
  • move agent to proper folder in Persons

And now I have one more task:

  • to assign proper agent login based on data from external database

I do it using following code:


			List<CfgAgentLoginInfo> logins = agent.getAgentInfo().getAgentLogins();
			
			if(logins == null)
				logins = new LinkedList<CfgAgentLoginInfo>();
			
			if(!logins.isEmpty())
			{
				logWarrningThatLogsWillBeCleared(agent,logins);
				
				logins.clear();
			}
			
			CfgAgentLoginInfo info = new CfgAgentLoginInfo(service, agent);
			info.setAgentLogin(agentLogin);
			info.setWrapupTime(0);

			logins.add(info);

			agent.getAgentInfo().setAgentLogins(logins);
			agent.save();

When I assign new Agent Login to person who does not have any Agent Login assigned everything works fine.

But when agent already have Agent Login and I would like to remove old one and then add new one following Exception occurs:


com.genesyslab.platform.applicationblocks.com.ConfigServerException: Validation error : [CFGDBError]  (ErrorType=CFGDBError, ObjectType=CFGNoObject, ObjectProperty=CFGNoProperty)
	at com.genesyslab.platform.applicationblocks.com.runtime.GlobalConfService.createConfigServerException(Unknown Source)
	at com.genesyslab.platform.applicationblocks.com.runtime.GlobalConfService.updateObject(Unknown Source)
	at com.genesyslab.platform.applicationblocks.com.CfgObject.save(Unknown Source)
	at com.genesyslab.platform.applicationblocks.com.CfgObject.save(Unknown Source)
	at com.genesyslab.platform.applicationblocks.com.objects.CfgPerson.save(Unknown Source)