         } else {
             rTag.tag = tag
         }
-        
+        rTag.recording = recording
         tags[tagsTypeControl.selectedSegmentIndex][tag] = rTag
     }
     

    
    private func removeTag(tag: String) {
        let rTag: RecordingTag = tags[tagsTypeControl.selectedSegmentIndex][tag]!
        managedObjectContext.delete(rTag)
        tags[tagsTypeControl.selectedSegmentIndex].removeValueForKey(tag)
    }
    
    private func addTag(tag: String) {

        addTag(tag)
        let cell = collectionView.cellForItemAtIndexPath(indexPath) as! TagCell
        cell.backgroundColor = tagCellSelectedColor
    }

    func collectionView(collectionView: UICollectionView, didDeselectItemAtIndexPath indexPath: NSIndexPath) {
        let tag = defaultTags[indexPath.item]
        removeTag(tag)
        let cell = collectionView.cellForItemAtIndexPath(indexPath) as! TagCell
        cell.backgroundColor = tagCellDeselectedColor
    }

    
