 // FIXME: To be removed! this is synchronous!                    activity.delete()
                     activity.deleteInBackground()
                 }
-                
+
                 if completionBlock != nil {
                     completionBlock!(succeeded: true, error: nil)
                 }

                    activity.deleteInBackground()
                }
            }
            
            // proceed to creating new like
            let likeActivity = PFObject(className: kPAPActivityClassKey)
            likeActivity.setObject(kPAPActivityTypeLike, forKey: kPAPActivityTypeKey)
            likeActivity.setObject(PFUser.currentUser()!, forKey: kPAPActivityFromUserKey)
            likeActivity.setObject(photo.objectForKey(kPAPPhotoUserKey)!, forKey: kPAPActivityToUserKey)
            likeActivity.setObject(photo, forKey: kPAPActivityPhotoKey)
            
            let likeACL = PFACL(user: PFUser.currentUser()!)
            likeACL.setPublicReadAccess(true)
            likeACL.setWriteAccess(true, forUser: photo.objectForKey(kPAPPhotoUserKey) as! PFUser)

                let query = PAPUtility.queryForActivitiesOnPhoto(photo, cachePolicy: PFCachePolicy.NetworkOnly)
                query.findObjectsInBackgroundWithBlock { (objects, error) in
                    if error == nil {

                        var likers = [PFUser]()
                        var commenters = [PFUser]()

                        var isLikedByCurrentUser = false

                        for activity in objects as! [PFObject] {
                            if (activity.objectForKey(kPAPActivityTypeKey) as! String) == kPAPActivityTypeLike {
                                likers.append(activity.objectForKey(kPAPActivityFromUserKey) as! PFUser)
                            } else if (activity.objectForKey(kPAPActivityTypeKey) as! String) == kPAPActivityTypeComment {
                                commenters.append(activity.objectForKey(kPAPActivityFromUserKey) as! PFUser)
                            }

                            if (activity.objectForKey(kPAPActivityFromUserKey) as! PFUser).objectId == PFUser.currentUser()!.objectId {
                                if (activity.objectForKey(kPAPActivityTypeKey) as! String) == kPAPActivityTypeLike {
                                    isLikedByCurrentUser = true
                                }
                            }
                        }

                        PAPCache.sharedCache.setAttributesForPhoto(photo, likers: likers, commenters: commenters, likedByCurrentUser: isLikedByCurrentUser)
                    }

                    NSNotificationCenter.defaultCenter().postNotificationName(PAPUtilityUserLikedUnlikedPhotoCallbackFinishedNotification, object: photo, userInfo: [PAPPhotoDetailsViewControllerUserLikedUnlikedPhotoNotificationUserInfoLikedKey: false])
                }

