internal void Delete(WorkspaceItem pWorkspaceItem)
 {
     uiFactory.StartNew(() => {
         lock (WorkspaceItems) {
             var objToRemove = WorkspaceItems.ToList().Where(i => i.ID.Equals(pWorkspaceItem.ID)).FirstOrDefault();
             if (objToRemove != null)
             {
                 WorkspaceItems.Remove(objToRemove);
                 OnPropertyChanged("SourceFiles");
             }
         }
     });
 }
        public void Remove(IContextualResourceModel resourceModel)
        {
            if (resourceModel == null)
            {
                return;
            }
            var itemToRemove = WorkspaceItems.FirstOrDefault(c => c.ServiceName == resourceModel.ResourceName);

            if (itemToRemove == null)
            {
                return;
            }

            WorkspaceItems.Remove(itemToRemove);
            Write();
            resourceModel.Environment.ResourceRepository.DeleteResourceFromWorkspaceAsync(resourceModel);
        }
        public void Remove(IContextualResourceModel resourceModel)
        {
            // BUG 9492 - 2013.06.08 - TWR : added null check
            if (resourceModel == null)
            {
                return;
            }
            var itemToRemove = WorkspaceItems.FirstOrDefault(c => c.ServiceName == resourceModel.ResourceName);

            if (itemToRemove == null)
            {
                return;
            }

            WorkspaceItems.Remove(itemToRemove);
            Write();
            resourceModel.Environment.ResourceRepository.DeleteResourceFromWorkspace(resourceModel);
        }