void ResourceThreadModel::Save(const ResourceRequest& request)
{
  DALI_ASSERT_DEBUG(request.GetType()->id == ResourceModel);

  DALI_LOG_INFO(mLogFilter, Debug::Verbose, "%s(%s)\n", __PRETTY_FUNCTION__, request.GetPath().c_str());

  bool success(false);

  BaseObject* baseObject = dynamic_cast<BaseObject*>(request.GetResource().Get());
  if( baseObject != NULL )
  {
    BaseHandle baseHandle(baseObject);
    ModelData modelData = ModelData::DownCast(baseHandle);
    if( modelData )
    {
      scoped_ptr<BinaryModelBuilder> modelBuilder (new BinaryModelBuilder(request.GetPath().c_str()));
      if ( modelBuilder->Write(modelData) )
      {
        success = true;

        // Construct SavedResource
        SavedResource resource( request.GetId(), request.GetType()->id);

        // Queue the loaded resource
        mResourceLoader.AddSavedResource(resource);
      }
    }
  }
  if( ! success )
  {
    // add to the failed queue
    FailedResource resource(request.GetId(), FailureUnknown);
    mResourceLoader.AddFailedSave(resource);
  }
}
void ResourceThreadModel::Load(const ResourceRequest& request)
{
  DALI_ASSERT_DEBUG(request.GetType()->id == ResourceModel);

  DALI_LOG_INFO(mLogFilter, Debug::Verbose, "%s(%s)\n", __PRETTY_FUNCTION__, request.GetPath().c_str());

  scoped_ptr<ModelBuilder> modelBuilder( CreateModelBuilder(request.GetPath()) );

  ModelData modelData = ModelData::New(modelBuilder->GetModelName());

  const bool success =  modelBuilder->Build(modelData);

  if( success )
  {
    // Construct LoadedResource and ResourcePointer for model data
    LoadedResource resource( request.GetId(), request.GetType()->id, ResourcePointer(&(modelData.GetBaseObject())));

    // Queue the loaded resource
    mResourceLoader.AddLoadedResource(resource);
  }
  else
  {
    // add to the failed queue
    FailedResource resource(request.GetId(), FailureUnknown);
    mResourceLoader.AddFailedLoad(resource);
  }
}