final EdmNavigationProperty navigationProperty = (EdmNavigationProperty) type.getProperty(navigationPropertyName);
final boolean isFeed = navigationProperty.getMultiplicity() == EdmMultiplicity.MANY;
final EdmEntitySet entitySet = entityInfo.getEntitySet();
final EdmEntitySet inlineEntitySet = entitySet.getRelatedEntitySet(navigationProperty);
WriteCallbackContext context = isFeed ? new WriteFeedCallbackContext() : new WriteEntryCallbackContext();
context.setSourceEntitySet(entitySet);
context.setNavigationProperty(navigationProperty);
context.setEntryData(data);
context.setCurrentExpandSelectTreeNode(properties.getExpandSelectTree().getLinks().get(
navigationPropertyName));
ODataCallback callback = properties.getCallbacks().get(navigationPropertyName);
if (callback == null) {
throw new EntityProviderException(EntityProviderException.EXPANDNOTSUPPORTED);