This feature took about 3 days of work to finish to my satisfaction. A large majority of my time is taken up by security and styling.
Security is critical to a website. When you are writing software that runs on someone's machine, you don't have to think about security nearly as much. (Unless it connects to other software.) Every action: viewing, creating, updating, and deleting, needs to be checked to verify only an authorized user can do them otherwise people could run around reading and deleting other user's messages. I also have to prevent people from doing more malicious things like trying to reply to messages that aren't theirs. These