public function lock($request)
    {
        $id = (int)$request->postVar('RecordID');
        $class = $request->postVar('RecordClass');

        $existing = RecordBeingEdited::get()->filter(array(
            'RecordID' => $id,
            'RecordClass' => $class,
            'EditorID' => Member::currentUserID()
        ))->first();

        if ($existing) {
            $existing->write(false, false, true);
        } else {
            $lock = RecordBeingEdited::create(array(
                'RecordID' => $id,
                'RecordClass' => $class,
                'EditorID' => Member::currentUserID()
            ));
            $lock->write();
        }
    }